ds1
variables contain data but an error NullReference Exception
occured at this point
`TextBox2.Text = ds1.Tables("Custmor").Rows(0).Item(0).ToString()`
Actual code block is :
Try
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Pradnya_DataB.mdb"
con.Open()
ds1 = New DataSet
ss = "Select c1.cust_name,c1.cust_bottle_type,c2.B_Pending From Customer c1"
ss = ss + " INNER JOIN Bottel_Collect c2 ON c2.Cust_ID=c1.Cust_ID WHERE c1.Cust_ID=" & CInt(lblText.Text)
'ss = "Select * from Customer"
da = New OleDbDataAdapter(ss, con)
da.Fill(ds1)
If ds1.Tables.Count > 0 Then
TextBox2.Text = ds1.Tables("Custmor").Rows(0).Item(0).ToString()
TextBox5.Text = ds1.Tables("Customer").Rows(0).Item(1).ToString()
TextBox6.Text = ds1.Tables("Bottel_Collect").Rows(0).Item(5).ToString()
End If
con.Close()
rd.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try