Author |
Topic |
ejazzaslam
Starting Member
2 Posts |
Posted - 2009-01-14 : 04:55:20
|
hello, i m use typed dataset and in query builder if i use insert command then query excute successfully , but if i user scope_identity after insert , query not passed with error " must declare @parrameter of insert command"if i declare that parameters then query excute but i cannnot pass parrameter in the code behind file.here is my syntax: INSERT INTO MPS_Avg_Company1 (Company_Avg_Description, ACTIVE, CREATED_BY, CREATION_DATE, UPDATED_BY, UPDATING_DATE, From_date, To_Date, From_Avg_Rate, To_Avg_Rate, Staus) VALUES (@Company_Avg_Description,@ACTIVE,@CREATED_BY,@CREATION_DATE,@UPDATED_BY,@UPDATING_DATE,@From_date,@To_Date,@From_Avg_Rate,@To_Avg_Rate,@Staus) SELECT scope_identity()error source: .sqlclintreadererror message: Must declare scalar variable @Company_Avg_Description |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
Ohmslaw
Starting Member
11 Posts |
Posted - 2009-01-14 : 22:13:50
|
Sounds like you are using an ODBC or Access connection. You will get this error becase it does not recognize @parm. You will need to replace each parameter with ? if this is the case.INSERT INTO MPS_Avg_Company1(Company_Avg_Description, ACTIVE, CREATED_BY, CREATION_DATE, UPDATED_BY, UPDATING_DATE, From_date, To_Date, From_Avg_Rate, To_Avg_Rate, Staus)VALUES (? ,?, ?, ?, ?, ?, ?, ?, ?, ?, ?)SELECT scope_identity()Then you would define your parameters for the command object in the order they are placed in you syntax.Ohms... |
|
|
|
|
|