HI:
Can someone tell me HOW to insert a automatic number after my user inserts new data from text boxes into the dataset. I keep getting this error:
Cannot insert the value NULL into column 'id', table; column does not allow nulls. INSERT fails. (ID IS MY KEY)
I can update & delete fine, but when I try to insert, I cannot figure out how to get the primary key inserted. I'm new @ this & I think I've confused myself....
THANK YOU
Dim conn As SqlConnection = GetSQLConnectio n()
Try
Dim sql As String = "Select * from table"
Dim sa2 As SqlDataAdapter = New SqlDataAdapter( sql, conn)
Try
If dataset.HasChan ges Then
sa2.Update(ds, "table")
dataset.AcceptC hanges()
End If
Finally
sa2.Dispose()
End Try
Finally
conn.Close()
conn.Dispose()
End Try
Can someone tell me HOW to insert a automatic number after my user inserts new data from text boxes into the dataset. I keep getting this error:
Cannot insert the value NULL into column 'id', table; column does not allow nulls. INSERT fails. (ID IS MY KEY)
I can update & delete fine, but when I try to insert, I cannot figure out how to get the primary key inserted. I'm new @ this & I think I've confused myself....
THANK YOU
Dim conn As SqlConnection = GetSQLConnectio n()
Try
Dim sql As String = "Select * from table"
Dim sa2 As SqlDataAdapter = New SqlDataAdapter( sql, conn)
Try
If dataset.HasChan ges Then
sa2.Update(ds, "table")
dataset.AcceptC hanges()
End If
Finally
sa2.Dispose()
End Try
Finally
conn.Close()
conn.Dispose()
End Try
Comment