Running My Laptop: Visual Basic 2010 Express & amp; SQL Server 2008
I have successfully used the connection wizard to connect to my databases in vb.net and read / write data using datasets / tableadapters / binding_source etc.
Now I'm trying to create a SQL connection to connect to my database to do some more complex queries. I was successful in being able to connect to my database with SQL, but by doing so it creates an error when it tries to run any .Fill () methods from my TableAdapters below.
The error produced is the following:. "... SqlException was unable to open the user default database login failed to login" Chris-PC "Chris user failed"
If I delete my SQL connection code, TableAdapter.Fill () The methods will work fine.
How can I use both databases at once? Any suggestions?
Here is the code: `
Dim connetionString string retarded CNN SqlConnection connetionString =" Data source = Chris-PC \ SQLEXPRESS, as in the initial list = database_db ; Integrated Security = SSPI; Trusted_Connection True =, "Cnn = New SqlConnection (connetionString) CNN.Open () MsgBox (" Open Connection! ") Cnn.Close () Hold Exception MsgBox (" Can not Open Connection! ") Try Me.JobsTableAdapter.Fill (Me. database_dbDataSet.jobs) Me.ApplicationsTableAdapter.Fill (Me.database_dbDataSet.applications) Me.ApplicantsTableAdapter.Fill (Me.database_dbDataSet.applicants) < P> `
So a few hours after more searching and testing, I was finally able to fix my problem.
The problem was with the connection string that is created with the configuration wizard for my datasets. The main problem is that it was "User Example = True"
When "User Example = True", you remove any other connection being able to connect to the server. So, I opened my app.config and changed that connection string which I was using in my code for SQL connectivity. After that, all worked fine.
Comments
Post a Comment