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

--
Message posted via http://www.dotnetmonster.com

Re: textbox data entry by Frankie

Frankie
Sat Jan 01 15:13:46 CST 2005

The dataadapter does not have a clear method, are you sure your not clearing
the data out of your dataset? What does the code that fills the dataset look
like?

"Norm Bohana via DotNetMonster.com" <forum@DotNetMonster.com> wrote in
message news:68f889c46d9a43ebb82dfd70ed09c838@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
>
> --
> Message posted via http://www.dotnetmonster.com



RE: textbox data entry by nbohana

nbohana
Mon Jan 03 20:13:03 CST 2005

I am sorry I used the following command!

dsOwnerAnimal1->Clear();

"Norm Bohana via DotNetMonster.com" wrote:

> 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
>
> --
> Message posted via http://www.dotnetmonster.com
>