Interview Question in SQL Server Security


 

Interview Question :: 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.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?

I am using VStudio 2005 and SQL Server Express 2005.
Answers to "Unable to connect to PUBS database"
RE: Unable to connect to PUBS database?

have you checked that you have pubs database in the database server.



try management studio login and ensure that the pubs database is exist

pon saravanan

http://www.vbknowledgebase.com
 
Vote for this answer ::  
Update Alert Setting