473,386 Members | 1,832 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,386 software developers and data experts.

DataSet and stored procedures

Hi!

Perhaps I should ask this at the sqlserver newsgroup but I'll try my luck
here, anyway :)

I have a stored procedure, which runs a select statement... then does a
search through the results
and return those, which match a special search criteria.
My questions are:
1 .How do I return a Dataset class (or something similar) from the stored
procedure?
2. How do I call the stored procedure? Up to now I have always used
SqlDataAdapter.Fill(dataset)

Any help is appreciated,
saso
Nov 15 '05 #1
1 1071
Try de following

SqlDataReader dr = null;

bool ret= true;

SqlParameter param = null;

SqlCommand cmd = new SqlCommand();

cmd.Connection = m_cn;

cmd.CommandType = CommandType.StoredProcedure;

cmd.CommandText = "StoredProcName";

param = new SqlParameter("@Parameter", SqlDbType.VarChar, 200);

param.Value = DBNull.Value;

cmd.Parameters.Add(param);

dr = cmd.ExecuteReader();

And your set

Kevin Moore

"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in message
news:bo**********@planja.arnes.si...
Hi!

Perhaps I should ask this at the sqlserver newsgroup but I'll try my luck
here, anyway :)

I have a stored procedure, which runs a select statement... then does a
search through the results
and return those, which match a special search criteria.
My questions are:
1 .How do I return a Dataset class (or something similar) from the stored
procedure?
2. How do I call the stored procedure? Up to now I have always used
SqlDataAdapter.Fill(dataset)

Any help is appreciated,
saso

Nov 15 '05 #2

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

Similar topics

5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
3
by: Mike P | last post by:
Is it possible to return a dataset from a stored procedure, or would you need to write the SQL in your .cs file to return the dataset? Any assistance would be really appreciated. Cheers, ...
9
by: Jarod | last post by:
Hey Will be in .net 2.0 any nice way to use stored procedures and get typed dataset ? Jarod
3
by: MDB | last post by:
I'd normally Google for a question like this, and hope to snag a few examples along with the answer, but this time I can't see to get the keywords specific enough. Or I'd ask coworkers, but...
4
by: paul | last post by:
Hi, Im trying to add a dataset to the app_code directory using vs2005 \ SQL2005 beta 2. When I run through the wizard I select the option to auto create new Stored Procedures (Select, update,...
5
by: Nita | last post by:
Hi, Im a sort of newbie when it comes to VB.NET, so forgive me if this is a simple question. I have a dataset i wish to clear, ive used a parameterised stored procedure from MS Access. Currently...
1
by: Jon Haakon Ariansen | last post by:
Hi all, I don't know where to publish this question but hope this newsgroup is okey. I'm working in Visual Studio 2005 and are now creating a dataset file where I will do all the transactions...
5
by: John | last post by:
Hi, I am developing a windows app using C# 2005. This app uses SQL Server or Oracle database depending on the what the user is using. Can I create one typed dataset and use it for SQL Server and...
3
by: Jon B | last post by:
Hi There! I'm looking into Strongly Typed DataSets in the .NET Framework. I know it can generated strongly typed tables as objects and column names as properties. However, one thing that I...
7
by: Matt | last post by:
So as you all know the great thing about ADO.NET is that I can take an entire table from a database and dump it into an in memory datatable using ADO.NET. Well my question is that now that I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.