Hi all, i am a new to VB.NET and i have a project to be completed urgently.
I need to insert information from textboxes into a database, I have created the connection using Jet Engine, the connection is working well because I can display records. However I cannot insert new records, it seems that the data adapter is not updating the database.
This is the insert code that I used:
Can you help me using a simple ex please!!
Suppose that name of dataset is dsAccount, the table has two fields called Username and Password, and the textboxes are txtUserName and txtPassword. The button to add new record is btnAdd
u can use this code to add record to a database
Private Sub B1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click
dim con As New ADODB.Connection
Dim tmp As New ADODB.Recordset
Dim s As String
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=K:\Database\db1.mdb"
s = "select * from add1"
tmp.Open(s, con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)