Lid |
|
Deze fout geeft hij:
"An error has ocodeccurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connection (Provider: SQL Netwerk Interfaces,error: 26 - Error Locating Server/Instance Specified"
Hier is mijn code misschien zit de fout daar.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim invoer As String
invoer = TextBox7.Text
Dim strQuery As String = "INSERT INTO Shell(fabrikant) VALUES('" & invoer & "')"
Dim myConn As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS; AttachDbFileName=C:\Documents and Settings\HP_Administrator\Mijn documenten\Shell.sdf; Integrated Security=True; User Instance=True")
Dim myCommand As New SqlCommand(strQuery, myConn)
Try
myConn.Open()
myCommand.ExecuteNonQuery()
Catch Ex As Exception
MessageBox.Show(Ex.Message)
Finally
myConn.Close()
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim invoer As String invoer = TextBox7.Text Dim strQuery As String = "INSERT INTO Shell(fabrikant) VALUES('" & invoer & "')" Dim myConn As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS; AttachDbFileName=C:\Documents and Settings\HP_Administrator\Mijn documenten\Shell.sdf; Integrated Security=True; User Instance=True") Dim myCommand As New SqlCommand(strQuery, myConn) Try myConn.Open() myCommand.ExecuteNonQuery() Catch Ex As Exception MessageBox.Show(Ex.Message) Finally myConn.Close() End Try End Sub
|