Insert SQL not working

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Hi

ignore this question ...... there is nothing wrong with the code ......

I did not realise with vb.net 2005 I had to contend with "design time" and
"run time" copies of the databse .......

Not to worry, I'm really quite pleased. I've been using these discussions
groups for 3-4 years and have received much valuable help ..... and this is
the first time Ive answered a posting (even if it is my own!!!)
 
Back
Top