Hi,
I am receiving an untyped DataSet from an Access database as a result
of an sql query on my website. It only contains one table at index
[0]. I then extract the values I need from the dataset and populate
various controls (text boxes, dropdownlists, checkboxes) as a result.
Now I am trying to:

1) Insert rows into the Dataset table based on any changes made to the
website controls.

2) Return this DataSet back to the database and update the database.

I believe my Dataset has one table and 6 columns in that table although
I am still not clear whether table and column names from the query are
also saved in the dataset.

Here is the code of how I am getting the data from the Dataset. The
First Try/Catch finds one type of "value" and the second does another.
At the end is where I would like the statements that will help me
insert rows to the dataset table to appear.

Thank you for any help


//1st Try/Catch
try
{
string assessmentID = assessmentIDTextBox.Text;
testDatasetTextBox.Text = assessmentID;

//Store the results of the Web Service
DataSet assessmentDataSet =
aapassessmentdata.findAAPAssessment(assessmentID);

//Finding the Present Pain value
try
{
if (assessmentDataSet.Tables[0].Rows[0]["value"].ToString()
== "301717006")
{
presentPainDropDownList.Text = "RUQ";
}
else if
(assessmentDataSet.Tables[0].Rows[0]["value"].ToString() ==
"301715003")
{
presentPainDropDownList.Text = "LUQ";
}
catch
{
testDatasetTextBox.Text = "Problems with Present Pain
Data";
}//End of Present Pain catch


//2nd Try/Catch

try
{
int rowCounter = assessmentDataSet.Tables[0].Rows.Count;
int tempCounter = 0;
while (tempCounter < rowCounter)
{
if
(assessmentDataSet.Tables[0].Rows[tempCounter]["aap_key"].ToString() ==
"2")
{
if
(assessmentDataSet.Tables[0].Rows[tempCounter]["value"].ToString() ==
"162477009")
{
movementCheckBox.Checked = true;
}
else if
(assessmentDataSet.Tables[0].Rows[tempCounter]["value"].ToString() ==
"162480005")
{
coughingCheckBox.Checked = true;
}

catch
{
testDatasetTextBox.Text = "Problems with Aggravating
Factors Data";
}



//where I would like the row insertion code to appear

if (coughingCheckBox.Checked == true)
{
//Insert a row in the [0] table in the dataset with a predetermined set
of values
}




Thank you kindly

Khurram

Re: Adding rows of data to Untyped DataSet by Cor

Cor
Fri Jul 21 02:33:52 CDT 2006

Deecrypt,

There are endless methods to add a datarow to a datatable (in more classes).
The standard one is.

DataRow dr = MyTable.NewRow();
dr[keyfield] = TheKey;
MyTable.Rows.Add(dr);
///Add the rest of the dr information to dr.

I hope this gives an idea,

Cor

"Deecrypt" <knahmad@gmail.com> schreef in bericht
news:1153418512.924115.183770@i42g2000cwa.googlegroups.com...
> Hi,
> I am receiving an untyped DataSet from an Access database as a result
> of an sql query on my website. It only contains one table at index
> [0]. I then extract the values I need from the dataset and populate
> various controls (text boxes, dropdownlists, checkboxes) as a result.
> Now I am trying to:
>
> 1) Insert rows into the Dataset table based on any changes made to the
> website controls.
>
> 2) Return this DataSet back to the database and update the database.
>
> I believe my Dataset has one table and 6 columns in that table although
> I am still not clear whether table and column names from the query are
> also saved in the dataset.
>
> Here is the code of how I am getting the data from the Dataset. The
> First Try/Catch finds one type of "value" and the second does another.
> At the end is where I would like the statements that will help me
> insert rows to the dataset table to appear.
>
> Thank you for any help
>
>
> //1st Try/Catch
> try
> {
> string assessmentID = assessmentIDTextBox.Text;
> testDatasetTextBox.Text = assessmentID;
>
> //Store the results of the Web Service
> DataSet assessmentDataSet =
> aapassessmentdata.findAAPAssessment(assessmentID);
>
> //Finding the Present Pain value
> try
> {
> if (assessmentDataSet.Tables[0].Rows[0]["value"].ToString()
> == "301717006")
> {
> presentPainDropDownList.Text = "RUQ";
> }
> else if
> (assessmentDataSet.Tables[0].Rows[0]["value"].ToString() ==
> "301715003")
> {
> presentPainDropDownList.Text = "LUQ";
> }
> catch
> {
> testDatasetTextBox.Text = "Problems with Present Pain
> Data";
> }//End of Present Pain catch
>
>
> //2nd Try/Catch
>
> try
> {
> int rowCounter = assessmentDataSet.Tables[0].Rows.Count;
> int tempCounter = 0;
> while (tempCounter < rowCounter)
> {
> if
> (assessmentDataSet.Tables[0].Rows[tempCounter]["aap_key"].ToString() ==
> "2")
> {
> if
> (assessmentDataSet.Tables[0].Rows[tempCounter]["value"].ToString() ==
> "162477009")
> {
> movementCheckBox.Checked = true;
> }
> else if
> (assessmentDataSet.Tables[0].Rows[tempCounter]["value"].ToString() ==
> "162480005")
> {
> coughingCheckBox.Checked = true;
> }
>
> catch
> {
> testDatasetTextBox.Text = "Problems with Aggravating
> Factors Data";
> }
>
>
>
> //where I would like the row insertion code to appear
>
> if (coughingCheckBox.Checked == true)
> {
> //Insert a row in the [0] table in the dataset with a predetermined set
> of values
> }
>
>
>
>
> Thank you kindly
>
> Khurram
>



Re: Adding rows of data to Untyped DataSet by Deecrypt

Deecrypt
Fri Jul 21 04:52:00 CDT 2006

Than you Cor,

I will follow your suggestion. I think this is what I am looking for.

Cheers

Cor Ligthert [MVP] wrote:
> Deecrypt,
>
> There are endless methods to add a datarow to a datatable (in more classes).
> The standard one is.
>
> DataRow dr = MyTable.NewRow();
> dr[keyfield] = TheKey;
> MyTable.Rows.Add(dr);
> ///Add the rest of the dr information to dr.
>
> I hope this gives an idea,
>
> Cor
>
> "Deecrypt" <knahmad@gmail.com> schreef in bericht
> news:1153418512.924115.183770@i42g2000cwa.googlegroups.com...
> > Hi,
> > I am receiving an untyped DataSet from an Access database as a result
> > of an sql query on my website. It only contains one table at index
> > [0]. I then extract the values I need from the dataset and populate
> > various controls (text boxes, dropdownlists, checkboxes) as a result.
> > Now I am trying to:
> >
> > 1) Insert rows into the Dataset table based on any changes made to the
> > website controls.
> >
> > 2) Return this DataSet back to the database and update the database.
> >
> > I believe my Dataset has one table and 6 columns in that table although
> > I am still not clear whether table and column names from the query are
> > also saved in the dataset.
> >
> > Here is the code of how I am getting the data from the Dataset. The
> > First Try/Catch finds one type of "value" and the second does another.
> > At the end is where I would like the statements that will help me
> > insert rows to the dataset table to appear.
> >
> > Thank you for any help
> >
> >
> > //1st Try/Catch
> > try
> > {
> > string assessmentID = assessmentIDTextBox.Text;
> > testDatasetTextBox.Text = assessmentID;
> >
> > //Store the results of the Web Service
> > DataSet assessmentDataSet =
> > aapassessmentdata.findAAPAssessment(assessmentID);
> >
> > //Finding the Present Pain value
> > try
> > {
> > if (assessmentDataSet.Tables[0].Rows[0]["value"].ToString()
> > == "301717006")
> > {
> > presentPainDropDownList.Text = "RUQ";
> > }
> > else if
> > (assessmentDataSet.Tables[0].Rows[0]["value"].ToString() ==
> > "301715003")
> > {
> > presentPainDropDownList.Text = "LUQ";
> > }
> > catch
> > {
> > testDatasetTextBox.Text = "Problems with Present Pain
> > Data";
> > }//End of Present Pain catch
> >
> >
> > //2nd Try/Catch
> >
> > try
> > {
> > int rowCounter = assessmentDataSet.Tables[0].Rows.Count;
> > int tempCounter = 0;
> > while (tempCounter < rowCounter)
> > {
> > if
> > (assessmentDataSet.Tables[0].Rows[tempCounter]["aap_key"].ToString() ==
> > "2")
> > {
> > if
> > (assessmentDataSet.Tables[0].Rows[tempCounter]["value"].ToString() ==
> > "162477009")
> > {
> > movementCheckBox.Checked = true;
> > }
> > else if
> > (assessmentDataSet.Tables[0].Rows[tempCounter]["value"].ToString() ==
> > "162480005")
> > {
> > coughingCheckBox.Checked = true;
> > }
> >
> > catch
> > {
> > testDatasetTextBox.Text = "Problems with Aggravating
> > Factors Data";
> > }
> >
> >
> >
> > //where I would like the row insertion code to appear
> >
> > if (coughingCheckBox.Checked == true)
> > {
> > //Insert a row in the [0] table in the dataset with a predetermined set
> > of values
> > }
> >
> >
> >
> >
> > Thank you kindly
> >
> > Khurram
> >