日期:2014-05-17  浏览次数:20463 次

ado.net的拆入语句问题,如何插入float类型的变量值?
 double bHotPrice1 =Convert.ToDouble((FormView1.FindControl("Sgq_bHotPriceLabel") as Label).Text);
            float  bHotPrice[/color = (float)bHotPrice1;
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Sgq_DBConnectionString"].ConnectionString.ToString()))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "insert into Sgq_Car_Order(Sgq_uName,Sgq_bName,Sgq_bISBN,Sgq_bHotPrice) values ('uName','bName','bISBN',[color=#FF99CC]bHotPrice)";

                    cmd.ExecuteNonQuery();
                    Response.Write("<script>alert('该书已经加入购物车!若要查看请点击购物车!')</script>");
                }

            }
如何把红色的float变量插入到数据库中?

------解决方案--------------------
cmd.CommandText = "insert into Sgq_Car_Order(Sgq_uName,Sgq_bName,Sgq_bISBN,Sgq_bHotPrice) values ('uName','bName','bISBN'," + bHotPrice + ")";