473,327 Members | 2,007 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,327 software developers and data experts.

using sqldatasource with few queries

Hi,

Is it possible to use the sqldatasource when I need a few
Select Commands on the same page?
I notice that I can put only one Select Command?
What is the recommanded approach in my case?

Thanks.
Ruthie.

Feb 11 '07 #1
2 1007
Better use separate sqldatasources. The whole idea of sqldatasource is to
make your data access as simple as possible. It is not good for anything
above primitive and trivial.

In many cases all you need is just to read some data with a single select
statement to populate a control. For this situation you will want to use a
light read-only access that is provided by datareader controls. You can use
a sqldatasource and set its DataSourceMode property to datareader. If you
want to be a bit more in control, use just an SqlCommand object and run
queries with the ExecuteReader method. The method returns a datareader that
you can databind to a control via the DataSource property.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<ru******@walla.co.ilwrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
Hi,

Is it possible to use the sqldatasource when I need a few
Select Commands on the same page?
I notice that I can put only one Select Command?
What is the recommanded approach in my case?

Thanks.
Ruthie.

Feb 11 '07 #2
On Feb 11, 5:24 pm, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Better use separate sqldatasources. The whole idea of sqldatasource is to
make your data access as simple as possible. It is not good for anything
above primitive and trivial.

In many cases all you need is just to read some data with a single select
statement to populate a control. For this situation you will want to use a
light read-only access that is provided by datareader controls. You can use
a sqldatasource and set its DataSourceMode property to datareader. If you
want to be a bit more in control, use just an SqlCommand object and run
queries with the ExecuteReader method. The method returns a datareader that
you can databind to a control via the DataSource property.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<ruthi...@walla.co.ilwrote in message

news:11**********************@p10g2000cwp.googlegr oups.com...
Hi,
Is it possible to use the sqldatasource when I need a few
Select Commands on the same page?
I notice that I can put only one Select Command?
What is the recommanded approach in my case?
Thanks.
Ruthie.- Hide quoted text -

- Show quoted text -
Thanks Eliyahu.

Your answer really helps!!!

Feb 12 '07 #3

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

Similar topics

0
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase...
3
by: Jim Andersen | last post by:
Hi, I would appreciate if someone could explain this behaviour, and maybe offer a better solution. I have been working with the GridView control. And SqlDataSource. It works great if I do:...
2
by: dba56 | last post by:
In an ASP.Net 2.0 page using SQL Server 2K, I have a editable gridview that is bound to a SQLDataSource using stored procedures for its select and update queries. The grid works fine but is slow...
3
by: mahajanvit | last post by:
Hi one and all I got this problem during my project. So in order to solve this I made a very small application. I am trying to insert using SP and sqldatasource control. I know that while using...
5
by: msch-prv | last post by:
Hi, I am trying to tie a SQLDataSource control to MySQL without success. The connection string works ok with an ObjectDataSource. (Native asp.net 2.0 MySQL dll loaded in /bin) For some reason,...
2
by: WebMatrix | last post by:
Hello, Stored procedure returns results of 3 different queries. On ASP.NET 2.0 page I have a SqlDataSource control with SelectCommand equals this stored procedure name. I want to be able to...
2
by: John Kotuby | last post by:
Hi all, I have set up a page with a Repeater and a SQLDatasource control, the data control suggested by online Help for use with the Repeater. I am getting Timeout Expired after 30 seconds. I...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
6
by: tshad | last post by:
I was looking at a page that showed how to set up a custom event and it seems to work ok. But I am not sure how I would use it. How would I subscribe to it. There is actual action (such as...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.