0

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.

Edited by __avd: Added [code] tags.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by __avd
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.