拖航合同:.net基本问题,急,在线等,谢谢好心人

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/06 01:07:05
这几行代码:
SqlConnection con = new SqlConnection("server=.;uid=sa;pwd=zhenyi;database=lala;");
con.Open();
SqlCommand com = new SqlCommand("select * from Customers where 检测日期 ="+i,con);
SqlDataReader dr = com.ExecuteReader();
this.DataGrid1.DataSource=dr;
this.DataGrid1.DataBind();
DataGrid1.Visible = true;
为什么显示NVCHAR转化到INT失败,我的数据库表中检测日期是NVCHAR的,应该怎么改正,先谢谢好心人!!!

SqlCommand com = new SqlCommand("select * from Customers where 检测日期 ='"+i.ToString() + "'",con);