The code I'm using:
Dim constring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\songs.accdb"
Using myconnection As New OleDbConnection(constring)
myconnection.Open()
Dim sqlQry As String = "INSERT INTO [Songs] ([Song], [Artist], [Number]) VALUES (@Song, @Artist, @Number)"
Using cmd As New OleDbCommand(sqlQry, myconnection)
cmd.Parameters.AddWithValue("@Song", txtsong.Text)
cmd.Parameters.AddWithValue("@Artist", txtartist.Text)
cmd.Parameters.AddWithValue("@Number", txtnumber.Text)
cmd.ExecuteNonQuery()
cmd.Dispose()
End Using
myconnection.Close()
End Using
I have no idea what the problem is when I execute nothing happens and no records get inserted into the data base? any idea what's wrong? P.S: I know it's a noob question and probably asked before sorry beforehand