I have used simple batch statments with C# (ans SQL Server 2000).for example:
string select = "select model from cars where id = ?;select * from trucks
where model = ?";
where ? is a parameter whose value i have before running the bach statment.

I was wondering if it possible to use the value retuned in the first
statement for the where clause in the second in the statment?

TIA,
Vinny

Re: Batch Statements by AMDRIT

AMDRIT
Tue Aug 30 11:01:13 CDT 2005

Try using a named token


SQLParamater SQLP = new SQLParamater("@ID",sqldatatype.int,4,"ID");
SQLP.value = 1

string select = "select model from cars where id = @ID;select * from trucks
where model = @ID";

SQLCommand cmd = new SQLCommand(select);
cmd.paramaters.add(SQLP);
cmd.execute;


"Vinny Vinn" <VinnyVinn@discussions.microsoft.com> wrote in message
news:4D8ED046-C99A-492E-9291-0B252D082517@microsoft.com...
>I have used simple batch statments with C# (ans SQL Server 2000).for
>example:
> string select = "select model from cars where id = ?;select * from trucks
> where model = ?";
> where ? is a parameter whose value i have before running the bach
> statment.
>
> I was wondering if it possible to use the value retuned in the first
> statement for the where clause in the second in the statment?
>
> TIA,
> Vinny