SQL Connection String Error

  • Thread starter Thread starter Skip9999999999
  • Start date Start date
S

Skip9999999999

Guest
I have developed a program for user to search a database. I did this on my local PC and it worked fine. I move the app to the server where it would used, changed the "Data Source" and I get an error (below). I used the name of the Server Name shown on the start up of SQL2008 R2 as the Data Source, which is the same thing I did on my local PC. I built a simple program just to test the Connection (below). I have tried different things, read everything I could find on the error, but no good. Any thoughts on what I might do to correct the problem?

Here is the code I'm using to test the connection:

Imports System.Data.SqlClient
Imports System.IO
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MyConnectionString As String = " Data Source=MenClub02;Database=eCom_Email;Integrated Security=SSPI"

Using connection As New SqlConnection(MyConnectionString)
connection.Open()
MsgBox("State: {0}", connection.State)
MsgBox("ConnectionString: {0}", connection.ConnectionString)
End Using

End Sub
End Class

The following error shows up on the "Using connection As New SqlConnection(MyConnectionString)" line:

System.TypeInitializationException

HResult=0x80131534

Message=The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.

Source=System.Data



Carl

Continue reading...
 
Back
Top