Ask a Question related to ASP.NET General, Design and Development.
-
Boris Zakharin #1
Error: Must Declare Variable
I have the following code upon which I receive the error "Must declare the
variable '@job_id'".
--Begin Code --
OleDbConnection conDetail = new
OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=ACRPPhilly;Data
Source=COMPUSA\\VSdotNET;Use Procedure for Prepare=1;Auto
Translate=True;Packet Size=4096;Workstation ID=COMPUSA;Use Encryption for
Data=False;Tag with column collation when possible=False");
OleDbDataAdapter datDetail = new OleDbDataAdapter();
OleDbCommand cmdDetail = new OleDbCommand("SELECT job_id, [Company Name],
[Position Title], [Position Contact Information], [Position Description],
discipline_id, City, state_id FROM dbo.jobs WHERE (job_id = @job_id)",
conDetail);
datDetail.SelectCommand = cmdDetail;
cmdDetail.Parameters.Add("@job_id", OleDbType.Integer, 10).Value =
Request["item"];
DataSet dsDetail = new DataSet();
datDetail.Fill(dsDetail);
-- End Code --
What am I doing wrong here?
Thanks,
Boris Zakharin
Boris Zakharin Guest
-
DECLARE SYNTAX
declare @x int set @x = (SELECT max(ixBugEvent) FROM bugevent) UPDATE bugevent SET ixAttachment = (SELECT max(ixAttachment) FROM attachment),... -
"Must declare the variable '@…..'." in GridView/DatailsView with M
I am testing ASP.NET 2.0 with MS SQL 2000. I get server error: "Exception Details: System.Data.SqlClient.SqlException: Must declare the variable... -
declare one variable
hello. in my linux machine in the php.ini i have register_globals on i one page i have: <?php if($que){ echo($que); } ?> -
How to declare the result of a loop as a variable?
I'm trying to include a list of people that's the result of looping through a recordset in a CDONTS mail. I'm trying to Dim the output of a loop,... -
how to declare session variable in global.asax file
please provide code sample, i was having trouble declaring interger and string variable and can we also initialize them at the same time thanks... -
Boris Zakharin #2
Re: Error: Must Declare Variable
Yes, I tried hard-coding the value to zero, but the error is still reported.
> Boris,
>
> Are you sure Request["item"] is not null?
>
>
> Chris.
> -------------
> C.R. Timmons Consulting, Inc.
> [url]http://www.crtimmonsinc.com/[/url]
Boris Zakharin Guest
-
Boris Zakharin #3
Re: Error: Must Declare Variable
I got it to work by change to WHERE (job_id = ?). This is acceptable for my
interests, but I should be able to create named parameters, right? I'm using
MSDE to host the database.
Boris Zakharin Guest



Reply With Quote

