Whenever I try to connect to the PUBS.MDF database, a login failed error message will appear.
I defined the connection string in the web.config file like this:
And setup the connection in the click event of a buttonCode:<connectionStrings> <add name="Pubs" connectionString="Data Source = localhost\SQLEXPRESS; Initial Catalog=Pubs;Integrated Security=SSPI"/> </connectionStrings>
And I put the PUBS.MDF file in the same folder as the vb source files.Code:Dim connectionString As String = WebConfigurationManager.ConnectionStrings("Pubs").ConnectionString Dim myConnection As New SqlConnection(connectionString) myConnection.Open() ..........
How do I connect to the database correctly?




Reply With Quote