G
Guest
Hi
Can anyone tell me where I have gone wrong with the following code : it runs
without errors, but does not insert the record in the table!
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim myConnection As SqlClient.SqlConnection
Dim myCommand As SqlClient.SqlCommand
Dim insertCMD As String
myConnection = New SqlConnection _
("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|" _
+ "\Bata_CallInfo.mdf;Integrated Security=True;User
Instance=True")
myConnection.Open()
insertCMD = "Insert into CallLog (AccessCode) values ('18002');"
myCommand = New SqlCommand(insertCMD, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
VB.net 2005 Express, SQL Server 2005 Express, Windows XP Professional
"AccessCode" is a field name of type (VarChar(17))
Thanks
Michael Bond
Can anyone tell me where I have gone wrong with the following code : it runs
without errors, but does not insert the record in the table!
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim myConnection As SqlClient.SqlConnection
Dim myCommand As SqlClient.SqlCommand
Dim insertCMD As String
myConnection = New SqlConnection _
("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|" _
+ "\Bata_CallInfo.mdf;Integrated Security=True;User
Instance=True")
myConnection.Open()
insertCMD = "Insert into CallLog (AccessCode) values ('18002');"
myCommand = New SqlCommand(insertCMD, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
VB.net 2005 Express, SQL Server 2005 Express, Windows XP Professional
"AccessCode" is a field name of type (VarChar(17))
Thanks
Michael Bond