Dim Customer As DataSet1TableAdapters.Customer1TableAdapter = New DataSet1TableAdapters.Customer1TableAdapter
        Dim Dt1 As New DataSet1.Customer1DataTable
        Dim TA1 As New DataSet1TableAdapters.Customer1TableAdapter
        Dim DR1 As DataSet1.Customer1Row

        Try
            Customer.InsertQuery(TxtCust.Text, MaskedPhone.Text, TxtAddress.Text, MaskedIC.Text, MaskedDL.Text)
            MsgBox("data entered")
            DR1 = Dt1.NewRow
            Dt1.Rows.Add()
            Customer.Update(Dt1)
            Dt1.AcceptChanges()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

i need help in this, i've searched the web and books but it cant seem to write any data to the database. it only writes it virtually. i've almost gave up.

Imports System.Data.OleDb

Public Class Form1

Private objconnect As OleDbConnection
  Private objcommand As OleDbCommand
    Private objreader As OleDbDataReader

Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click

objconnect = New OleDbConnection
        objconnect.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
                                      "Data Source = YOUR_DB.mdb"
        objcommand = New OleDbCommand

        objcommand.CommandText = "INSERT INTO `Customers` (`customer`, `phone`, `address`) VALUES ('" & txtcust.text & "', '" & maskedphone.text & "', '" & txtaddress.text & "')"

        objcommand.Connection = objconnect

        'Open the connection
        objconnect.Open()

        ' Execute's query
        objcommand.ExecuteNonQuery()

        ' closes connection
        objconnect.Close()

end sub 
end class

This will input everything into the database for you. All you have to do is change the first part of the SQL query to the field names in the table

i need help in this, i've searched the web and books but it cant seem to write any data to the database. it only writes it virtually. i've almost gave up.

Dim Customer As DataSet1TableAdapters.Customer1TableAdapter = New DataSet1TableAdapters.Customer1TableAdapter

        Try
            Customer.InsertQuery(TxtCust.Text, MaskedPhone.Text, TxtAddress.Text, MaskedIC.Text, MaskedDL.Text)
            MsgBox("data entered")
        
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
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.