954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

add new row in access 2007

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.

phoenix32
Newbie Poster
1 post since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

Hi,

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

Luc001
Posting Whiz
376 posts since Mar 2010
Reputation Points: 85
Solved Threads: 98
 

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.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: