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..
ruhi 13
Light Poster
Recommended Answers
Jump to PostI guess the error is from the sql database side. Set the column to accept nulls and try it out.
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.