本文介绍了如何将varchar转换为float.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里附有我的编码,它显示以下错误,任何人都可以纠正该错误.
错误:
here with attched my coding it shows following error can anyone correct the error.
Error:
Error converting data type varchar to float.
错误编码:
Error Codding:
price_range = BulletedList3.Items[e.Index].Value;
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("select pro_img,pro_name,price from product where price= ''" + price_range + "''and status=''A'' and type=''retail'' ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DataList1.DataSource = ds;
DataList1.DataBind();
con.Close();
推荐答案
SqlCommand cmd = new SqlCommand("select pro_img,pro_name,price from product where price= " + price_range.ToString() + " and status='A' and type='retail' ", con);
这篇关于如何将varchar转换为float.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!