I am using OLEDBConnection and OLEDBDataAdapter and connected to the MS-Access database.
how can i add the textbox value to the table in database on a button click and want to display it in datagridview??

If I'm understanding your question correctly, you need to add a dataset, add a datagrid to your form, then change the data source property of the datagrid to point to the dataset.

I will give you a sample which will guide you on this particular subject.
In your Form1 suppose you have:
1 DataGridView1
1 Textbox1
1 Button1

In your Database suppose you have

1 Table1
1 Field1 = Textfield

you can rename them if you like, so in your Button1_Click event

'our conn is outside the Button_Click so that we can re-use it anywhere within the Form1.

Dim conn As New Oledb.OledbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source = Your Database Name;Persist Security Info = False")

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If Textbox1.Text = "" Then
   MsgBox ("Textbox1 is Empty")
   Exit Sub

Dim da As New Oledb.OledbDataAdapter("Select * FROM Table1", conn)
Dim ds As New DataSet
Dim dt As DataTable, row As DataRow
Dim cb As New Oledb.OledbCommandBuilder(da)
dt = ds.Tables(0)
row = dt.NewRow

row("Field1") = Textbox1.Text


MsgBox ("1 Record Inserted")
DataGridView1.DataSource = Nothing
Textbox1.Text =""
End Sub

Private Sub dView()
Dim da As New Oledb.OledbDataAdapter("Select Field1 From Table1 Order By Field1", conn)
Dim dt As New DataTable

Dim col0 As New DataGridViewTexBoxColumn
col0.HeaderText = "My Field 1"
col0.DataPropertyName = "Field1"
col0.Width = 150

DataGridView1.DataSource = dt

End Sub
This article has been dead for over six months. Start a new discussion instead.