D
Deecrypt
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
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