Reputation: 467
I am a newbie in using asp.net, I have a problem with this error see link http://i40.tinypic.com/2ikrpi.jpg. The connection is place in a module
Imports System.Data.SqlClient
Imports System.Data
Imports Microsoft.VisualBasic
Public Module connection
Public cn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\JUSTINE\Documents\Visual Studio 2005\WebSites\ACESCHOOLSUPPLIES\App_Data\ACESCHOOLSUPPLIES.mdf;Integrated Security=True;User Instance=True")
end module
Whenever I get that error I have to change again the sqlconnection so that the connection will work again.I am worrying about this, Iam afraid that this error will appear on the presentation day. Can anyone help me how to fix this?? thanks in advance
Upvotes: 0
Views: 44
Reputation:
From the picture that you've posted that means your sql query wasn't closed yet in the previous query.
But you can try this connection statement declaration
Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename='|DataDirectory|ACESCHOOLSUPPLIES.mdf';Integrated Security=True;Connect Timeout=30;User Instance=True")
If you declare your connection like you did in your form it will get some error when you upload your project to your real windows hosting because it address will redirect to your path that not exist in your hosting disk. Hope this helps you.
Upvotes: 1