G
Guest
Hi
Is there any way to refresh a DataSet after inserting few records in a table
(containing foreignKey column) using adapters' InsertCommand and
ExecuteNonQuery(). I tried adapter's Fill(dataSet) but it does not add the
new records inserted to the dataset's table. I am doing something like:
adapter->InsertCommand = gcnew SqlCommand(L"INSERT INTO Sample " +
"(sampleID, type, dateReceived, dateExpiry, supplierID)"+
" VALUES (@sampID, @type, @dtRcvd, @dtExp, @suppID)", conn);
int r = adapter->InsertCommand->ExecuteNonQuery();
adapter->Fill(dataset);
Ofcourse all the parameter's are defined and the record is inserted to the
dataSource table.
Because of the foreignKey column I can not just add a newRow to DataSet and
then use adapter's Update() method as it throws an exception.
I am using VC++ (VisualStudio 2005 and SQL Server 2005) for the interface.
Thanks for any information.
Manjree
Is there any way to refresh a DataSet after inserting few records in a table
(containing foreignKey column) using adapters' InsertCommand and
ExecuteNonQuery(). I tried adapter's Fill(dataSet) but it does not add the
new records inserted to the dataset's table. I am doing something like:
adapter->InsertCommand = gcnew SqlCommand(L"INSERT INTO Sample " +
"(sampleID, type, dateReceived, dateExpiry, supplierID)"+
" VALUES (@sampID, @type, @dtRcvd, @dtExp, @suppID)", conn);
int r = adapter->InsertCommand->ExecuteNonQuery();
adapter->Fill(dataset);
Ofcourse all the parameter's are defined and the record is inserted to the
dataSource table.
Because of the foreignKey column I can not just add a newRow to DataSet and
then use adapter's Update() method as it throws an exception.
I am using VC++ (VisualStudio 2005 and SQL Server 2005) for the interface.
Thanks for any information.
Manjree