jasonwucinski
Member
- Joined
- Mar 30, 2010
- Messages
- 8
- Programming Experience
- 1-3
Hi everyone. im trying to connect to an .sdf database but when i try to connect i get an error. this is the code i have on the onclick event:
and i get this error:
5 A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Whats going on? how do i connect to the db?
thanks
jason
VB.NET:
Dim someName As String = Me.TextBox1.Text
Using connection As New SqlConnection("Data Source=D:\Visual Studio\Projects\Work_Link_New_Applicant\Work_Link_New_Applicant\MyDatabase#1.sdf")
Using command As New SqlCommand("INSERT INTO tblWorkLink_ID(WorkLinkID) VALUES (@Name)", connection)
command.Parameters.AddWithValue("@Name", someName)
connection.Open()
command.ExecuteNonQuery()
End Using
End Using
and i get this error:
5 A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Whats going on? how do i connect to the db?
thanks
jason