disconnected dataset and dataadapter. my table contains 3 fields of eid,name,sal my program able to update 2 fields but when i want to update eid the error null error exception is coming
my code is
Dim
con As New SqlConnection("workstation id=SHYPN220;packet size=4096;user id=sa;initial catalog=pubs;persist security info=True") Dim da As New SqlDataAdapter("select * from emp", con) Dim cb As SqlCommandBuilder Dim ds As New DataSetPrivate
Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim r As DataRowcon.Open()
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds, "emp")
cb =
New SqlCommandBuilder(da) Dim x As Integer = Val(t1.Text)r = ds.Tables("emp").Rows.Find(x)
r.Item(0) = Val(t1.Text)----------> here i am getting
errorr.Item(1) = t2.Text
r.Item(2) = Val(t3.Text)
da.Update(ds, "emp")
MsgBox("record updated")
con.Close()
End Sub so please give the solution urgently
Replies
Know the answer? Post it — somebody with the same question will find it here.