SqlDataSource and multiple recordsets

G

Guest

Hi all,

Could I use the sqldatasource with stored-procedure to return multiple
recordset? I did not want to have any sqldatasourec in the one page just to
return the record back to dropdownlists. In my stored procedure will have 2
select statement. If it can be done how I refer to each dropdownlist to
correct recordset. Please advise. Thanks.
 
C

Cowboy \(Gregory A. Beamer\)

The SqlDataSource is a piece of software that wraps all functionality in one
convenient wrapper. Underneath the hood it contains all of the plumbing to
make simple drag and drop and configure a reality. In .NET, you use multiple
SqlDataSource controls to complete multiple steps. You might be able to
kludge this, but I am not sure it is worth it. If you want to go this route,
you can try concatenating multiple SQL statements, but I am not sure how you
would separate out the many tables. But, I have not dug deeply into the
SqlDataSource.

If you need to step outside of this box, you should learn about the
underlying objects and code you own data access.
 
B

Beowulf

From what I've read the SqlDataSource works with 1 table only. A
dataset can be filled with multiple tables from your stored procedure,
though.

From here http://forums.asp.net/t/1021356.aspx:

"I think everybody is half-correct here.

If you want a SqlDataSource, you would need one for each table. Not
sure why that is a big deal.

But you *can* issue multiple unrelated selects in a single stored proc
and load them into a DataSet and reference them by table."
 
G

Guest

Thanks for your quick reply.

I have been using dataset to do most of it. Do you think with multiple
SqlDataSource call it will ok? Because I read about how to handle the
connection most the time they recommanded not to do that. I will end up to
have about 5-6 trips to fill the dropdowlist.
 
C

Cowboy \(Gregory A. Beamer\)

It depends on how many users you will have on your site. If you are google,
then I would not recommend the multiple DataSource option. If a hobbiest or
small business site, it will get you to market quicker.

If it were me, I would use a tiered approach, but I focus more on Enterprise
level solutions. If you want to get a feel for this, there are some starter
apps from Microsoft or you can go the full monty with something like
www.dofactory.com 's Design Framework. It is relatively cheap for the amount
of code, samples and documentation and will give you a leg up on tiered
design.

I am not real fond of the DataSource controls, although I do see why they
are there. If you do go that route, consider goind AJAX, although EW will
not help as much as VWD in this respect. If you are cascading the dropdowns,
there is a nice way to do this with the AJAX controls, but you will need VWD
to complete the tasks. Check it out at http://ajax.asp.net and make sure you
look at the cascading dropdown video tutorial. You then feed the controls
based on what is updating. Pretty cool if you ask me. And, it reduces your
hits on subsequent AJAX calls, so it will reduce the "damage" from the
DataSource, if you go that route.
 
C

Cowboy \(Gregory A. Beamer\)

Sorry about the EW comment. I thought I was still in the Expression Web
group. The rest of the post applies.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top