讀取當天的數據,按照CarPcdList.GoTime來判斷。
ALTER PROCEDURE CarPcdListShowAS
select * from CarPcdList where
convert(datetime,convert(char(10),CarPcdList.GoTime,120))=convert(datetime,convert(char(10),getdate(),120))
and state='已安排'
RETURN
存儲過程在Sql2000裡執行時,可以讀取數據,但是在C#中調用該過程時,數據讀取不出
SqlConnection myConn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString"));
SqlDataAdapter myDa=new SqlDataAdapter();
myDa.SelectCommand=new SqlCommand();
myDa.SelectCommand.CommandText= "CarPcdListShow";
myDa.SelectCommand.CommandType=CommandType.StoredProcedure;
myDa.SelectCommand.Connection=myConn; DataSet myDs=new DataSet();
myDa.Fill(myDs,"thisTab");
如果把where語句刪除,就可以在C#調用,數據讀取了
ALTER PROCEDURE CarPcdListShowAS
select * from CarPcdList where
convert(datetime,convert(char(10),CarPcdList.GoTime,120))=convert(datetime,convert(char(10),getdate(),120))
and state='已安排'
RETURN
存儲過程在Sql2000裡執行時,可以讀取數據,但是在C#中調用該過程時,數據讀取不出
SqlConnection myConn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString"));
SqlDataAdapter myDa=new SqlDataAdapter();
myDa.SelectCommand=new SqlCommand();
myDa.SelectCommand.CommandText= "CarPcdListShow";
myDa.SelectCommand.CommandType=CommandType.StoredProcedure;
myDa.SelectCommand.Connection=myConn; DataSet myDs=new DataSet();
myDa.Fill(myDs,"thisTab");
如果把where語句刪除,就可以在C#調用,數據讀取了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货