Hello,
I am trying this..
Imports System.Data.OleDb
Public Class Form1
Dim conn As OleDbConnection
Dim cmd As OleDbCommand
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
conn = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=c:\nikhil.mdb")
conn.Open()
Dim row As DataRowView=ComboBox1.SelectedValue
Dim row1 As DataRowView = ComboBox2.SelectedValue
Dim row2 As DataRowView = ComboBox3.SelectedValue
cmd = New OleDbCommand("insert into table1 values( " & row.Row("id").ToString & ",' " & row1.Row("name").ToString & " ', " & row2.Row("salary").ToString & ")", conn)
cmd.ExecuteNonQuery()
conn.Close()
End Sub
I get an error: object reference not set to an instance of an object