各位大虾:
小弟有一问题请教。
sql = "update Pub_Product_Ratio set Enabled='0' where ProductID = " + ProductID + " and EffectDate < " + CurDate + " ";
SqlConnection conn = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
int flag = cmd.ExecuteNonQuery();
conn.Close();
<<数据库为Sql-Server2000>>
表Pub_Product_Ratio中为什么EffectDate只能是datetime类型的,我换成了nvarchar类型的就会报错
可是我需要nvarchar类型的啊
System.Data.SqlClient.SqlException: 第 1 行: '11' 附近有语法错误。
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DataAccess.Pub_Product_Ratio.UpdateSetEnabled(String CurDate, String maxDate, String mode, String ProductID) in e:\ruanmw\wwwroot\finasales\dataaccess\pub_product_ratio.cs:line 31
at WebService.PubManage.myTest(String CurProductID, String CurDate, String mode) in e:\ruanmw\wwwroot\finasales\webservice\pubmanage.asmx.cs:line 89
小弟有一问题请教。
sql = "update Pub_Product_Ratio set Enabled='0' where ProductID = " + ProductID + " and EffectDate < " + CurDate + " ";
SqlConnection conn = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
int flag = cmd.ExecuteNonQuery();
conn.Close();
<<数据库为Sql-Server2000>>
表Pub_Product_Ratio中为什么EffectDate只能是datetime类型的,我换成了nvarchar类型的就会报错
可是我需要nvarchar类型的啊
System.Data.SqlClient.SqlException: 第 1 行: '11' 附近有语法错误。
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DataAccess.Pub_Product_Ratio.UpdateSetEnabled(String CurDate, String maxDate, String mode, String ProductID) in e:\ruanmw\wwwroot\finasales\dataaccess\pub_product_ratio.cs:line 31
at WebService.PubManage.myTest(String CurProductID, String CurDate, String mode) in e:\ruanmw\wwwroot\finasales\webservice\pubmanage.asmx.cs:line 89
解决方案 »
- Cookie和Session实现自动登录的问题
- 上传进度显示的问题(高手帮忙)
- 请教:像Repeater这种控件能横向绑定数据么?
- 使用.net语言开发网站具体有哪些步骤?
- dropdownlist中的selectItem 和selectIndex 有什么区别?在线等!
- 求助:关于数据库中日期的查询
- 急救!一个asp.net中的数据库操作问题。
- reporting services 运用的问题?
- 求教!DataGrid如果是在runtime时自动生成的列则提交时会自动清空DataGrid,为何?
- 请教简单的ASPX程序问题
- 大家能谈谈decimal与money类型的区别吗?
- datagrid中放了一个DataKeyField我有什么办法使我点击这个button1可以获得该button1所在的对应行的kuid号呢?
EffectDate < '" + CurDate + "'";(注意有')至于用varchar比较日期没有试过不知道行不行