sql = "select buyid as 单据号,buydate as 进货日期,proname as 商品名称,progys as 供应商,proprice as 单价,prounit as 单位,pronum as 商品数量,promoney as 金额 from buy_info where buydate before " + stime + " and buydate after " + etime + " order by buydate,buyid";sql = "select buyid as 单据号,buydate as 进货日期,proname as 商品名称,progys as 供应商,proprice as 单价,prounit as 单位,pronum as 商品数量,promoney as 金额 from buy_info where buydate >= " + stime + " and buydate <=" + etime + " order by buydate,buyid";这两种都不对。
我刚接触c#,不太清楚这些语法。请教各位高人,正确的sql语句应该怎么写?
谢谢!
我刚接触c#,不太清楚这些语法。请教各位高人,正确的sql语句应该怎么写?
谢谢!
我将sql语句改成这样,没有提示错误,但是找不到数据。这是我数据库中的数据:
先在查询分析中执行一下!!!
要对应日期字段,在C#中还要对应格式
set TimeBegin = '××××'
declare dateTime @TimeEnd
set TimeEnd = '*****'
select buyid as 单据号,buydate as 进货日期,proname as 商品名称,progys as 供应商,proprice as 单价,prounit as 单位,pronum as 商品数量,promoney as 金额 from buy_info where buydate BETWEEN @TimeBegin and @TimeEnd order by buydate,buyid
有具体的sql语句吗?
select buyid as 单据号,buydate as 进货日期,proname as 商品名称,progys as 供应商,proprice as 单价,prounit as 单位,pronum as 商品数量,promoney as 金额 from buy_info where buydate BETWEEN to_date('2009-7-1','yyyy-mm-dd') and to_date('2009-7-9','yyyy-mm-dd') order by buydate,buyid