Good day!

Im a new programmer in vb.net and it seems that i cant update my table in access 2007 here is my code.

Try

 con = new oledb.oledbConnection("Provider = Microsof.ACE.OLEDB.12.0"; data source = 
       |DAtaDirectory|\Attendance.accdb; Persist Security Info = False;")
 con.Open()
 sql = "INSERT INTO tblProf VALUES('"&txtEmpNo.Text&"',            
       '"&txtProfName.text&"','"&txtProfLname.Text&"')"
 cmd = New OleDbCommand(sql,con)
 icount = cmd.ExecuteNonQuery()
 MessageBox.Show(icount)

Catch ex as Exception
Finally
 con.close()
 ds.dispose()

End Try

--I dont received an error message when i run the codes i even dont receive an exception message. but when i check my database the record was not added.

I hope you can help me. thanks in advance.

Hi,

You can find some information about insert a new row, here.

Use absolute path of database (.sdf).

con = new oledb.oledbConnection("Provider = Microsof.ACE.OLEDB.12.0"; data source = 
       c:\folder\Attendance.accdb; Persist Security Info = False;")

Or checkout content of the database under Bin\Debug folder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.