.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

problem with an insert-works in testing but not on web server

Posted By: Zugzwang     Posted Date: June 29, 2011    Points:5   Category :Sql Server
Hello All,
I am new to asp.net and sql server. I am also new to this forum. :) My problem concerns a web application. It is asp.net app, with vb.net code behind. The app presents a form the user fills it in and clicks a button to submit it. On the click event, the code inserts the data into a SQL server express db (a simple 1 table db). This works well in the Visual Studio testing environment, however the records are not inserting into the db when the app is directly accessed on the server from a browser. Has anyone experienced a similar glitch? Is Visual Studio doing something for me behind the scenes that does not happen on the web server? Thank you in advance for any suggestions or hints of what my problem may be. -Lawrence Blankenship

Author: Pandian             
Posted Date: June 30, 2011     Points: 20   


1. Is there any Error while you connecting the DB Server ?
2. If no Error, Did you check whether the Request properly reached to the DB server through SQL Profiler ?
3. If no request from the Application to the DB Server, Did you check whether the connection is redirecting to some other Server insteadof the DB Servee.... ?


If not I then who, If not now then when
Author: Gowthammanju             
Posted Date: June 30, 2011     Points: 20   


with out knowing about ur code how can we post solution to ur questions

just post it

Thanks & Regards,

Mark if the answer is true
Author: Zugzwang             
Posted Date: June 30, 2011     Points: 20   

1. No there is no error. The insert doesn't occur (unless I am in the visual studio -- when i debug, i watch the code step through the insert command, and then I see the record in the db) Is it possible to be in debug mode while I am using the browser?
2. I am not sure what SQL profiler is, however, when I run in visual studio, I can query the db and see the record. When I am not in visual studio, no record is inserted. (as an aside, I built another page to read from the database. It works fine in visual studio, but again it does not work through the browser)
3. I could use some help figuring out the answer to this one, please. If it works in visual studio, would it not work in the web browser too?

Gowthammanju: I was kinda looking for help from the sql server side of things, since the code works in visual studio and also since the read works in visual studio. It seems to me that there is something about visual studio that I don't know about that causes the code to work. I was hoping that there would be some expertise in the sql server express db as well.

Thank you both for responding. ANY ideas are much appreciated.

Author: Zugzwang             
Posted Date: June 30, 2011     Points: 20   

Ok I found some information here: http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx AND http://msdn.microsoft.com/en-us/library/Bb264564

This info is old (v. 2005), but it seems like it might be related to what my problem is. Can someone help me understand instances, database files and how they are used?

Thanks :)

Author: Gowthammanju             
Posted Date: June 30, 2011     Points: 20   


Catch the exception and post your exception...

I think some credential problem is preventing to insert the data.

Thanks & Regards,

Mark if the answer is true
Author: Zugzwang             
Posted Date: June 30, 2011     Points: 20   

Best I can tell there is no exception. There is no abend at all. Gowthammanju do you believe and error is occurring that is not showing?

Author: Zugzwang             
Posted Date: June 30, 2011     Points: 20   

We found a solution.
- we created a sql server database login and gave it read/write roles to the database
- we used a connection string that used the uid=newID; password=newPW;
- we put the new connection string into .vb code behind
- after the string worked in the code behind, we copied it exactly into the web.config file
Now accessing the the page through a web browser works completely including the insert into the database.

Thank you all for trying to help! :)

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend