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:
Me.BindingContext(DsAccount1, "Account").AddNew()

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

Please can anyone tell me how to do it??

why don't you have a look at this link

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)
        MsgBox("Record Saved")
Exit Sub

Hey thanks all of you. I will try them and let you know, I'm sure it will work.
thx again :)

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.