|
-
Apr 16th, 2003, 11:50 AM
#1
Thread Starter
Hyperactive Member
Stored Procedure, Web Service, Dataset, Argh...
I have a Web Service that is calling a Stored Procedure in MS SQL 2000, the only problem is i dont remember how to get the returned results from the procedure to show from my web service. I can execute a procedure with no problem as long as i dont get data back, but i am running a procedure to get data back, my return type for the procedure is a DataSet, so i guess i need to get the procedure results into my dataset to return. Help!
Thanks!
..::[ kleptos]::..
- Database Administrator (MSSQL 2000)
- Application Developer (C#)
- Web Developer (ASP.NET)

-
Apr 16th, 2003, 01:02 PM
#2
Something like this:
Code:
[WebMethod]
public DataSet getMyData()
{
try
{
SqlConnection cn = new SqlConnection("YourConnectionStringHere");
cn.Open();
SqlCommand cm = new SqlCommand("StoredProcName", cn);
SqlDataAdapter da;
DataSet ds = new DataSet();
cm.CommandType = CommandType.StoredProcedure;
//if you have parameters, add them here
//cm.Parameters.Add("@ParameterName", SqlDbType.Int);
//cm.Parameters["@ParameterName"].Value = YourValueHere;
da = new SqlDataAdapter(cm);
da.Fill(ds, "MyData");
cn.Close();
return ds;
}
catch(Exception ex)
{
//here do something with the execption
}
}
-
Apr 16th, 2003, 04:03 PM
#3
Thread Starter
Hyperactive Member
..::[ kleptos]::..
- Database Administrator (MSSQL 2000)
- Application Developer (C#)
- Web Developer (ASP.NET)

-
Aug 29th, 2006, 01:49 PM
#4
Member
Re: Stored Procedure, Web Service, Dataset, Argh...
Dear Serge or any one else can explain these steps.... infact i will be realy thankful
-
Sep 5th, 2006, 07:07 AM
#5
Fanatic Member
Re: Stored Procedure, Web Service, Dataset, Argh...
He created a method, getMyData, that can be called as a webservice method to return a dataset object. The method simply creates a connection to the database, creates a dataset object, fills that object with data, and returns it. Does that make sense?
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Nov 14th, 2006, 01:59 PM
#6
Member
Re: Stored Procedure, Web Service, Dataset, Argh...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|