G
Guest
Hi,
Firstly, I will apologise now if I have posted in the wrong discussion
group. Please let me know if I have for future reference. Below is the code
to a WebMethod that is querying an Access 2003 database, saving the results
as a dataset and returning the dataset.
[WebMethod(Description = "Method to take in assessment_id as input" +
" and send the assessment data to the aap web website to populate" +
" its fields")]
public DataSet findAAPAssessment(string assessmentID)
{
//Establish a connection with the database
//Assign the type and destination of the database being queried
string source = "Provider = Microsoft.JET.OLEDB.4.0;data source =
C:\\leedsuni\\mscproject\\seconddemo\\snomedepr.mdb;";
//Create a new connection and use the string "source" to assign
//a value to the connection
OleDbConnection o = new OleDbConnection(source);
//Open Connection
o.Open();
//Initialise string representing the query to search the database
string query = "SELECT * FROM abdominalpainassessmentrecords WHERE
assessment_id = " + assessmentID + ");
//Create a dataset and load assessment data into database
//For creating a dataset with the results of the query
OleDbDataAdapter assessmentTableAdapter = new
OleDbDataAdapter(query, source);
DataSet assessmentDataSet = new DataSet();
assessmentTableAdapter.Fill(assessmentDataSet,
"abdominalpainassessmentrecords");
//Close connection
o.Close();
return assessmentDataSet;
}
However I get a SOAP exception error at the client side when client attempts
to consume the webmethod by providing a string value assessmentID. I should
point it out that the above method works perfectly if I explicitly assign a
value to my webMethod call i.e "3" instead of assessmentID.
protected void getAssessmentData_Click(object sender, EventArgs e)
{
string assessmentID = assessmentIDTextBox.Text;
DataSet assessmentDataSet =
aapassessmentdata.findAAPAssessment(assessmentID);
}
Thank you kindly and I look forward to your replies
Khurram
Firstly, I will apologise now if I have posted in the wrong discussion
group. Please let me know if I have for future reference. Below is the code
to a WebMethod that is querying an Access 2003 database, saving the results
as a dataset and returning the dataset.
[WebMethod(Description = "Method to take in assessment_id as input" +
" and send the assessment data to the aap web website to populate" +
" its fields")]
public DataSet findAAPAssessment(string assessmentID)
{
//Establish a connection with the database
//Assign the type and destination of the database being queried
string source = "Provider = Microsoft.JET.OLEDB.4.0;data source =
C:\\leedsuni\\mscproject\\seconddemo\\snomedepr.mdb;";
//Create a new connection and use the string "source" to assign
//a value to the connection
OleDbConnection o = new OleDbConnection(source);
//Open Connection
o.Open();
//Initialise string representing the query to search the database
string query = "SELECT * FROM abdominalpainassessmentrecords WHERE
assessment_id = " + assessmentID + ");
//Create a dataset and load assessment data into database
//For creating a dataset with the results of the query
OleDbDataAdapter assessmentTableAdapter = new
OleDbDataAdapter(query, source);
DataSet assessmentDataSet = new DataSet();
assessmentTableAdapter.Fill(assessmentDataSet,
"abdominalpainassessmentrecords");
//Close connection
o.Close();
return assessmentDataSet;
}
However I get a SOAP exception error at the client side when client attempts
to consume the webmethod by providing a string value assessmentID. I should
point it out that the above method works perfectly if I explicitly assign a
value to my webMethod call i.e "3" instead of assessmentID.
protected void getAssessmentData_Click(object sender, EventArgs e)
{
string assessmentID = assessmentIDTextBox.Text;
DataSet assessmentDataSet =
aapassessmentdata.findAAPAssessment(assessmentID);
}
Thank you kindly and I look forward to your replies
Khurram