hello to all,
I am making a database project in vb.net. I have one table which has 9 columns. I am
using ms access database as server side. my question is that, how to insert rows with
values in a table.please help me. thanks.

First of all for your kind information access db is not for client server application you must choose sql server or mysql or oracle as database. Ok to insert a new record in access databse first of all you ahould declare this library

Imports System.Data.OleDb

Then here the code to insert new record in your database table please make changes as required by you here is the code

If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Then
            MessageBox.Show("Please enter the required field", " You Software name", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If

        Dim cnString As String

        cnString = ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\DB.mdb;")


        Dim sqlQRY As String = "SELECT * FROM Table1"

        'Create connection
        Dim conn As OleDbConnection = New OleDbConnection(cnString)

        Try
            ' Open connection
            conn.Open()

            'create data adapter
            Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlQRY, conn)

            'create command builder
            Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(da)

            'create dataset
            Dim ds As DataSet = New DataSet

            'fill dataset
            da.Fill(ds, "Table1Name")

            'get data table
            Dim dt As DataTable = ds.Tables("Table1Name")

            Dim newRow As DataRow = dt.NewRow()
            newRow("C1Name") = TextBox1.Text
            newRow("C2Name") = TextBox2.Text
            newRow("C3Name") = TextBox3.Text
            newRow("C4Name") = TextBox4.Text
            dt.Rows.Add(newRow)

            'update customers table
            da.Update(ds, "Table1Name")

            MsgBox("Record successfully saved...", MsgBoxStyle.Information)
        Catch ex As OleDbException
            MsgBox("Error: " & ex.ToString & vbCrLf)
        Finally
            ' Close connection
            conn.Close()
        End Try
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""

If you have any problem let me know if it resolve your problem then please mark the thread as solved.

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.