Hi,
I've the following error in my code.can you please rectify this error.please do the needful.
Error:-
Error converting data type nvarchar to bigint.
public void getdata()
{
string strondate, strinvoicedate;
//int id = Convert.ToInt32(label5.Text.ToString());
DataTable dt=new DataTable ();
SqlConnection con=new SqlConnection ("data source=mars-104;initial catalog=marsweb;integrated security=true");
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 );
//SqlParameter prm=new SqlParameter("@invoiceno",label4.Text );
cmd.Parameters.AddWithValue("@invoiceno",label8 .Text );
da .Fill (dt );//Error shows here as:- Error converting data type nvarchar to bigint.
if (dt .Rows .Count > 0 )
{
label2.Text =dt.Rows[0]["compname"].ToString ();
label3 .Text =dt .Rows [0]["compaddress"].ToString ();
label8 .Text =dt.Rows [0]["invoiceno"].ToString ();
label9 .Text =dt.Rows [0]["orderno"].ToString ();
strondate =dt.Rows [0]["ondate"].ToString ();
if (strondate !="null" )
{
char [] separator=new char [] { ' ' };
string [] s1=strondate .Split (separator );
string date=s1 [0].ToString ();
label10 .Text =date ;
}
strinvoicedate =dt .Rows [0]["invoicedate"].ToString ();
if (strinvoicedate !="null")
{
char []separator=new char[] { ' ' };
string[] s1= strinvoicedate .Split (separator );
string date=s1 [0].ToString ();
label11 .Text =date;
}
label15 .Text =dt .Rows [0]["netamount"].ToString ();
label16 .Text =dt.Rows [0]["netvat"].ToString ();
label17 .Text =dt .Rows [0]["tamount"].ToString ();
}
con .Close ();
}
Best,
Sudheep.