Bug in SqlClient.SqlCommand.Parameters collection

M

moondaddy

I'm trying to execute a sql server 2k stored procedure using ado.net 1.1 and
I keep getting an error where ado isn't recognizing a parameter in the
stored procedure. Then when I rem out the parameter being passed in (the
one that's not being recognized in the sp), I get an error saying that the
SP is expecting that parameter. I've triple checked everything to make sure
there's no typos. I've never seen this error before and I cant seem to get
around it.

Here's the parameter being created in vb.net:
cmd.Parameters.Add("@Pj_BUCs_ID, ", SqlDbType.Int).Direction =
ParameterDirection.Input

Here's the param in the SP:

ALTER PROCEDURE dbo.spProject_LU_put
(
@Pj_ID int,
@Pj_ClientID int,
@Pj_DP_ID int,
@Pj_No varchar(25),
@Pj_Name varchar(75),
@Pj_Desc varchar(1000),
@Pj_ManagerID int,
@Pj_DeptID int,
@Pj_Rgn_ID int,
@Pj_Trm_ID int,
@Pj_BS_ID int,
@Pj_BSOther varchar(150),

@Pj_BUCs_ID int, --THIS ONE!!!!!!!!!!!!!!!!!!!
more params....

And here's the error saying its not part of the sp:
System.Data.SqlClient.SqlException: @Pj_BUCs_ID, is not a parameter for
procedure spProject_LU_put.

at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at VIPNowClient.Project_DAL.Save(dsProject ds) in
D:\nwis\Project_DAL.vb:line 504</Exception>


And here's the error when I rem it out of ado.

System.Data.SqlClient.SqlException: Procedure 'spProject_LU_put' expects
parameter '@Pj_BUCs_ID', which was not supplied.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at VIPNowClient.Project_DAL.Save(dsProject ds) in
D:\nwis\Apps\JamesMcCuish\VS\VIPNow\VIPNowClient\DAL\Project_DAL.vb:line
504</Exception>


Is this a known but in ado? Does anyone know of a solution to this?

Thanks.
 
P

Patrice

Tehe parameter is ""@Pj_BUCs_ID, " (note the comma). Is this a prolbme when
cutting.pasting or in your oriignal code ?

The easiest way to diagnose this is to dump the parameter collection...

Patrice
 
M

moondaddy

Thanks! I must need new glasses.

--
(e-mail address removed)
Patrice said:
Tehe parameter is ""@Pj_BUCs_ID, " (note the comma). Is this a prolbme
when
cutting.pasting or in your oriignal code ?

The easiest way to diagnose this is to dump the parameter collection...

Patrice

--
 

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

Top