Unable to connect to PUBS database
-
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 under the connectionstrings section like this: [code] add name="Pubs" connectionString="Data Source = localhost\SQLEXPRESS; Initial Catalog=Pubs;Integrated Security=SSPI" [/code] And setup the connection in the click event of a button: [code] Dim connectionString As String = WebConfigurationManager.ConnectionStrings("Pubs").ConnectionString Dim myConnection As New SqlConnection(connectionString) myConnection.Open() .......... [/code] And I put the PUBS.MDF file in the same folder as the vb source files. How do I connect to the database correctly?
-
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 under the connectionstrings section like this: [code] add name="Pubs" connectionString="Data Source = localhost\SQLEXPRESS; Initial Catalog=Pubs;Integrated Security=SSPI" [/code] And setup the connection in the click event of a button: [code] Dim connectionString As String = WebConfigurationManager.ConnectionStrings("Pubs").ConnectionString Dim myConnection As New SqlConnection(connectionString) myConnection.Open() .......... [/code] And I put the PUBS.MDF file in the same folder as the vb source files. How do I connect to the database correctly?
KaKa` wrote:
add name="Pubs" connectionString="Data Source = localhost\SQLEXPRESS; Initial Catalog=Pubs;Integrated Security=SSPI"
This looks for a named instance of SQL Server called SQLEXPRESS, and then tries to find a DB called pubs in there. It sure as hell isn't going to find a file called 'pubs.mdf' ( which is an access database )
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
KaKa` wrote:
add name="Pubs" connectionString="Data Source = localhost\SQLEXPRESS; Initial Catalog=Pubs;Integrated Security=SSPI"
This looks for a named instance of SQL Server called SQLEXPRESS, and then tries to find a DB called pubs in there. It sure as hell isn't going to find a file called 'pubs.mdf' ( which is an access database )
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )