vb.net - datagrids inserting records
- From: "Wally" <myxfactor@xxxxxxxxxxxxxxxx>
- Date: Mon, 23 May 2005 10:17:07 -0700
I have a datagrid that I need to insert records into but I want my users to
only enter data into one field and I want to fill the rest of the new
information from parameter fields.
When my code checks for "HasChanges" I set the parameter values for the
empty fields and when the code gets to the "SqlDataAdapter1.Update" I get a
message that my key field does not allow nulls (one of my parameter fields).
The message box title line said "Error when committing the to the original
data store".
What am I missing?
I'm using the parameters defined in the Windows generated code to set the
key field and remaining data fields.
See code same below.
Thanks……
If DsUpdateDetailInfo1.HasChanges Then
SqlInsertCommand1.Parameters("@PermitId").Value = MyPermitNo
SqlInsertCommand1.Parameters("@UpdateDt").Value = DateTime.Now
SqlInsertCommand1.Parameters("@UpdateUserId").Value = "Me123"
SqlUpdateCommand1.Parameters("@PermitId").Value = MyPermitNo
SqlUpdateCommand1.Parameters("@UpdateDt").Value = DateTime.Now
SqlUpdateCommand1.Parameters("@UpdateUserId").Value = "Me123"
SqlDataAdapter1.Update(DsUpdateDetailInfo1)
.
- Follow-Ups:
- RE: vb.net - datagrids inserting records
- From: Kevin Yu [MSFT]
- RE: vb.net - datagrids inserting records
- Prev by Date: DAAB for Microsoft Access
- Next by Date: Recommendation for database access
- Previous by thread: DAAB for Microsoft Access
- Next by thread: RE: vb.net - datagrids inserting records
- Index(es):