Question VB 2008 express remote SQL Server 2005 express

89tqYvEj7b

New member
Joined
Mar 4, 2010
Messages
3
Programming Experience
10+
Hi,
I am about to embark on a long term project using VB.net 2008 and SQL Server 2005. I am an Access developer with more than 12 years experience but the last time I used VB.net it was version 2003 and SQL Server 7.0. Things have change somewhat over the years.
To prep for the project, I installed SQL Server 2005 express on a Windows XP computer and attached the AdventureWorks_Data database file. I enabled remote connections.
On a Windows 7 computer I installed VB 2008 express. I wrote a simple windows form app with a text box where I could enter a connection string and button to test the connection. But try as I might I cannot establish a connection. Error 26 is as close as I can come. I can connect to the database using Access XP, 2003, and 2007 on 3 different computers and operating systems. I can view or query the database from Access including from the computer where VB 2008 express is installed.
I have tried disabling the anti-virus that I use. I have tried many different connedtion strings.
Below is the code that I use and some of the connection strings that fail. Any help would be greatly appreciated.

Imports System.Data.SqlClient

Public Class FormTableList

Private Sub cmdTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTest.Click
Dim strConn As String
Dim AdventureConn As New SqlConnection
Dim strError As String
strConn = TextBox1.Text
AdventureConn.ConnectionString = strConn
Debug.Print(strConn)
'Exit Sub
Try
AdventureConn.Open()
MessageBox.Show("Connection Successful")
Catch ex As Exception
strError = "Connection Failed" & vbCrLf & ex.Message
MessageBox.Show(strError)
Debug.Print(ex.Message)
End Try
AdventureConn.Close()
End Sub

Server=SONYV\MSSQLEXPRESS;Database=AdventureWorks_Data;Trusted_Connection=True;

Data Source=SONYV;Initial Catalog=AdventureWorks_Data;Integrated Security=SSPI;

Data Source=SONYV\MSSQLEXPRESS;Initial Catalog=AdventureWorks_Data;Integrated Security=True;Connect Timeout=30;User Instance=True

Thanks in Advance
 

Latest posts

Back
Top