hello everyone,
i m trying to add row in database through this code:
PrivateSub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
Dim rowNew As System.Data.DataRow = DataSet31.Tables(0).NewRow
Dim temp As Random
rowNew.Item(4) = temp
Response.Write(rowNew.Item(4)) '**
DataSet31.Tables(0).Rows.Add(rowNew)
DataGrid1.EditItemIndex = DataGrid1.Items.Count
DataGrid1.DataSource = DataSet31
DataGrid1.DataBind()
End Sub
but when i click on add buton i get error that primary key cannot be null so i write ** line, but still getting error(i m using sql as database)
pl anyone help me..

yeah i got the answer it was the error sql database thankyou for your answer

This question has already been answered. Start a new discussion instead.