I am making a simple program to keep database of employee at office but its been long since I used vb.net I used to connect through sql server
but now I am trying to use, ms access as database here is my problem.
I cannot insert data into database entered from textboxes can someone help me with this code.
Then I want to populate this on a grid and provide a search option some examples of this program if you can suggest me please let me know
thanks need this badly my job is at stake :P
I am designer by the way
this is what i have created so far
PHP Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If cn.State = ConnectionState.Open Then cn.Close()
cn.Open()
cmd = New OleDb.OleDbCommand("insert into main values('" & TextBox1.Text & "','" & TextBox2.Text & "')", cn)
cmd.ExecuteNonQuery()
MessageBox.Show("record added", "success")
cn.Close()
Catch ex As Exception
MessageBox.Show("error occured")
End Try
End Sub
it shows record added successfully but when I open the table there is no record in there




Reply With Quote