sqlexception was unhandled?

Posted by Sudheep.grandhe under C# on 11/7/2011 | Points: 10 | Views : 894 | Status : [Member] | Replies : 1
Hi,

I have the following error.sqlexception was unhandled?Must declare the scalar variable "@invoiceno".

SqlCommand cmd=new SqlCommand ("select compname,compaddress,invoiceno,orderno,ondate,invoicedate,netamount,netvat,tamount from tbl_Report2 WHERE invoiceno=@invoiceno ",con );

Best,
Sudheep.



Responses

Posted by: Umeshdwivedi on: 11/8/2011 [Member] Starter | Points: 25

Up
0
Down
This is not at all a good way of selecting data. Create a stored procedure in your database, write all your queries in the procedure itself and call it by passing the parameters from cs code.
or
you can show your full code here then i help you

Latest Technology Trainer
And Part time software consultant

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response