Is it possible to connect to a SQL 2005 Express db using Visual Basic 2005
Express?
I cannot get past the connection.open statement without the error
"...Version=2.0.0.0; SqlClient.SqlClientPermissions;
PublicKeyToken=b77a5c561934e089 failed."
I have WinXP, SQL Express 2005, and VB 2005 Express all on same machine.
I've found hundreds of samples and tried most of them, but still get same
error.
I would like to publish the code and install on another computer that will
access this computer for the database, but I can't even get it to work on
this one.
Any help would be greatly appreciated, Thanks in advance.
Here are some of the connection strings I've tried:
'*********sql client*********************
Protected Const SqlConnectionString As String= _
"Data Source=localhost;" & _
"AttachDbFilename='R:\dbFileName.mdf'; & _
"Integrated Security=True;" & _
"Connnect Timeout=30;" & _
"User Instance=True;"
Protected connection As String = SqlConnectionString
Dim connection As New SqlConnection(connectionString)
connection.Open()
'**************************************
(I've also tried replacing the line "Data Source" with
"Server=MyCompterName;
and "Server=tcp:MyComputerName;" and "Server=MyComputerName,port"
and "Server=MyComputerName\SQLEXPRESS"
And I've tried removing the line "AttachDbFileName or replacing it with
"Database=dbFileName"
and removing the line "Connect Tiimeout" and "User Instance"
)
'***********ole client************************
Protected Const SqlConnectionString As String= _
"Provider=SqlOledb.1;" & _
"Data Source=MyComputerName; & _
"Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"DataBase=dbFileName;"
Protected connection As String = SqlConnectionString
Dim connection As New OleDbConnection(connectionString)
connection.Open()
'********************************************
(I've tried removing the "Persist Security Info" also)