Hi,
it shows the error as :sqlexception was unhandled.Must declare the scalar variable "@InvoiceNo".
DataTable dt=new DataTable ();
SqlConnection con=new SqlConnection ("data source=mars-104;initial catalog=marsweb;integrated security=true");
con .Open ();
SqlCommand cmd=new SqlCommand ("select CompName,CompAddress,InvoiceNo,OrderNo,OnDate,InvoiceDate,NetAmount,NetVat,TAmount from tbl_Report2 WHERE InvoiceNo= @InvoiceNo",con );
SqlDataAdapter da=new SqlDataAdapter (cmd );
cmd.Parameters .AddWithValue ("@invoiceno");
da .Fill (dt );//it will shows the error
Best,
Sudheep.
Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator