Create new row using a typed dataset
I am using a strong-typed dataset object (.xsd) object - simplistic at this point to illustrate the problem.
What I want is code to
a) Insert a row into a dataset object
b) Bind the dataset to the gridview, the gridview should show the data.
c) If the user wants to edit the gridview data they can.
d) The data should be committed to the database after.
This is the code I have so far - the error message I am getting is below it, the table definition is below the error message.
Dim dt As New table2.Table2DataTable
dt.BeginLoadData()
Dim dr As DataRow = dt.NewRow
'
dr("fld1") = "a"
dr("fld2") = "b"
dt.LoadDataRow(dr.ItemArray, False)
dt.EndLoadData()
error message: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
Table2
ID - Integer- Identity Column
fld1 - varchar2(10)
fld2 - varchar2(10)
|