473,382 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Passing a String variable to a Web Service

Hi,
Passing a string parameter to a webservice to get the dataset generated
as the result, seems to give me an error suggesting that no parameter
is being passed. However it works if I explicitly state the value as
the parameter. Code in Csharp being developed in VS2005 for ASP.NET.
Below is my webservice code.
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.md b;";

//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 dataset

//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;

}
My client website simply wants returned dataset. This code is below

protected void getAssessmentData_Click(object sender, EventArgs e)
{

string assessmentID = assessmentIDTextBox.Text;
DataSet assessmentDataSet =
aapassessmentdata.findAAPAssessment(assessmentID);
}

I think my problem is with using a string datatype but I'm not sure.
Please help.

Thank you

Khurram

Jul 17 '06 #1
1 1805
I should also point out that the error i get is a SOAPexception error
that suggets that no parameter is being sent.

Cheers

Khurram
Deecrypt wrote:
Hi,
Passing a string parameter to a webservice to get the dataset generated
as the result, seems to give me an error suggesting that no parameter
is being passed. However it works if I explicitly state the value as
the parameter. Code in Csharp being developed in VS2005 for ASP.NET.
Below is my webservice code.
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.md b;";

//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 dataset

//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;

}
My client website simply wants returned dataset. This code is below

protected void getAssessmentData_Click(object sender, EventArgs e)
{

string assessmentID = assessmentIDTextBox.Text;
DataSet assessmentDataSet =
aapassessmentdata.findAAPAssessment(assessmentID);
}

I think my problem is with using a string datatype but I'm not sure.
Please help.

Thank you

Khurram
Jul 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Amr Mostafa | last post by:
Hello :) I'm trying to write a script that deals with a web service. I'm using NuSoap class. my question is : Can I pass some variables By Reference to the web service and get the result back...
0
by: Ted | last post by:
Would someone tell me why I am getting: "An unhandled exception of type 'System.NullReferenceException' occurred in microsoft.visualbasic.dll. Additional information: Object variable or With...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
3
by: Paul Michaud | last post by:
Consider the following: Class A { .... } Class B:A { ....
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
4
by: thomasp | last post by:
In the code below I have a function that tests if a file exists. It takes a variable named strFileName, simple enough. My question is, is there a way to pass it a variable with another name as...
3
by: James Robertson | last post by:
I am new to the ASP and VB thing so be kind. Question I have is that I have created an ASPX web site to use as an E-Mail page. But I want to use this for a lot of users. Can I create the link on...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
10
by: amazon | last post by:
Our vender provided us a web service: 1xyztest.xsd file... ------------------------------------ postEvent PostEventRequest ------------------------------------- authetication authentication...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.