Getting error for the simple code Please help me out.
Thank you
I have a textbox and one table. Once the user enters data in the textbox & click save button, the data gets saved to database. I've written following code but I'm getting following error. Please help me out. Thank you
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'Dim ds As DataSet
If tbxNote.Text <> String.Empty Then
Dim NoteRow As ChemComp_adminDS.GeneralNotesRow = m_ccDb.Chemcomp_adminDS.GeneralNotes.NewGeneralNotesRow
'Dim crow As DataRow = ds.Tables("GeneralNotes").Rows(0)
'User entered comment for this susbstanceID for the first time so new row to be inserted in
'to AdminComment table
' NoteRow.NoteID = CInt(NoteRow.Item("NoteId"))
NoteRow.CreatedBy = My.User.Name
NoteRow.CreatedOn = Now
NoteRow.ModifiedBy = My.User.Name
NoteRow.ModifiedOn = Now
NoteRow.Note = tbxNote.Text.Trim()
m_ccDb.InsertRow(NoteRow)
End If
'm_ccDb.GetList(m_ccDb.Chemcomp_adminDS.GeneralNotes)
End Sub
End Class
at the time of insertrow function iam getting the following error.
Cannot insert explicit value for identity column in table 'GeneralNotes' when IDENTITY_INSERT is set to OFF.