Re: Executing a select statement multiple times?
From: Sahil Malik (contactmethrumyblog_at_nospam.com)
Date: 11/09/04
- Next message: Sahil Malik: "Re: ExecuteNonQuery() - Bach SQL Statement execution?"
- Previous message: Sahil Malik: "Re: Limit in Dataset?"
- In reply to: Nathan: "Executing a select statement multiple times?"
- Next in thread: Val Mazur: "Re: Executing a select statement multiple times?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 9 Nov 2004 17:11:52 -0500
The answer depends on "What do you need to execute this query for?".
DataReader could work, and will be the fastest for a single user scenario,
but a dataadapter might work better if the sequence is used to for example
generate unique ids, when you don't want to use guids.
In which scenario, your best bet could still be executing the sequence on a
per request basis, and not allowing that operation to be a part of any other
transaction (to prevent deadlocks). You might even want to consider
Command.Execute*.* .. there are indeed a lot of possibilities :-)
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
Please reply to the newsgroups instead of email so everyone can benefit from
your reply.
"Nathan" <Nathan@discussions.microsoft.com> wrote in message
news:7828E019-33FB-4C50-ABAB-6A9BBE63755A@microsoft.com...
> Hi,
>
> What is the efficient way of executing the database sequence multiple
times?
>
> Suppose for example, I have a DB Sequence like this:
> "Select SequenceName.NEXTVAL from TBLName;"
>
> I want to execute this multiple times and populate a collection. How do I
> achieve this efficiently? Do I have to use DataReader multiple times? If
so,
> how do I do that?
> There's no support for stored procedures/functions in the DBMS, so I can't
> go that route.
> Any code snippets will help.
>
> Thanks.
>
- Next message: Sahil Malik: "Re: ExecuteNonQuery() - Bach SQL Statement execution?"
- Previous message: Sahil Malik: "Re: Limit in Dataset?"
- In reply to: Nathan: "Executing a select statement multiple times?"
- Next in thread: Val Mazur: "Re: Executing a select statement multiple times?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|