i have an error in convert function?

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

i have an error in convert function?.i am underlying the error part.can u please rectify this problem.Please do the needful.

Error:-Incorrect syntax near the keyword 'convert'.
public void reportsgridview()
{
SqlConnection con = new SqlConnection("data source=mars-104;initial catalog=marsweb;integrated security=true");
SqlCommand cmd = new SqlCommand("select invoiceno,orderno convert(varchar(15),ondate,105),convert(varchar(15),invoicedate,105),netamount,netvat,tamount from tbl_report2", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
con.Open();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
}
else
{

}
}

Best,
Sudheep.



Responses

Posted by: Ulhasmorbale on: 11/2/2011 [Member] Starter | Points: 25

Up
0
Down
select invoiceno,orderno convert(varchar(15),ondate,105),convert(varchar(15),invoicedate,105),netamount,netvat,tamount from tbl_report2

there is no comma after orderno and b4 convert

Regards,
Ulhas Morbale

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

Login to post response