Resolved add data into table

lhdvbnet

Member
Joined
Feb 25, 2009
Messages
15
Programming Experience
Beginner
i have this block of code for adding data into table called Orders. But it doesn't work. I don't know why. Please help me.. :(
--------------------------------
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Try
Dim com As New OleDbCommand
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
System.Environment.CurrentDirectory.ToString() & "\Orders.mdb")
con.Open()
com.Connection = con

com.CommandText = "INSERT into Orders VALUES(" & txtNum.Text & ",'" & txtOrderDay.Text & "','" & _
txtShipVia.Text & "','" & txtShipCountry.Text & "'," & txtShipName.Text & ")"

'com.ExecuteNonQuery()
MsgBox("Record Inserted")
Catch exp As Exception
MsgBox(exp.ToString())
End Try
End Sub
------------------------------------------
thank in advanced
 
Back
Top