N
Norm Bohana via DotNetMonster.com
I enter data into several textbox's. and try to save it to a SQL table using the following code:
Before this code is executed I do a 'sqlDataAdapter->Clear', and then enter the new data.
private: System::Void btnOSave_Click(System::Object * sender, System::EventArgs * e)
{
void UpdateDataSet(DataSet* dsOwnerAnimal1);
// Check for changes to the dataset
if(!dsOwnerAnimal1->HasChanges(DataRowState::Modified)) return;
MessageBox::Show("we got here 2");
// Create a temporary Dataset
DataSet* xOwner;
MessageBox::Show("we got here 3");
// Get the changes to the data (Modified Rows Only)
xOwner = dsOwnerAnimal1->GetChanges(DataRowState::Modified);
MessageBox::Show("we got here 4");
// Check the Dataset for Errors
if(xOwner->HasErrors) {
MessageBox::Show("There were Errors, Did not Update!");
return;
}
This does not work because I get no data into the dsOwnerAnimal1 dataset. Can someone tell me what I am doing wrong?
Norm
Before this code is executed I do a 'sqlDataAdapter->Clear', and then enter the new data.
private: System::Void btnOSave_Click(System::Object * sender, System::EventArgs * e)
{
void UpdateDataSet(DataSet* dsOwnerAnimal1);
// Check for changes to the dataset
if(!dsOwnerAnimal1->HasChanges(DataRowState::Modified)) return;
MessageBox::Show("we got here 2");
// Create a temporary Dataset
DataSet* xOwner;
MessageBox::Show("we got here 3");
// Get the changes to the data (Modified Rows Only)
xOwner = dsOwnerAnimal1->GetChanges(DataRowState::Modified);
MessageBox::Show("we got here 4");
// Check the Dataset for Errors
if(xOwner->HasErrors) {
MessageBox::Show("There were Errors, Did not Update!");
return;
}
This does not work because I get no data into the dsOwnerAnimal1 dataset. Can someone tell me what I am doing wrong?
Norm