我收到以下错误“将 varchar 数据类型转换为 datetime 数据类型导致值超出范围。” 日期格式为“DD/MM/YY”
public DataSet GetSynchronizeDataForDLDocs(string date_pushed)
{
DataSet ds = new DataSet();
string strQuery=string.Empty;
if (date_pushed != null && date_pushed != string.Empty) // 105
strQuery =
@"select
a.DLNO,
a.NAME,
b.TOPSTRING,
Convert(datetime,a.DOB,103) as DOB,
Convert(datetime,a.DOI,103) as DOI,
Convert(datetime,b.datepushed,103) as datepushed
from
PLInfo_Demo a,
DLInfo_Demo b
where
a.dlno=b.dlno
and
Convert(DateTime,b.datepushed,103) > CONVERT(varchar,'" + date_pushed + @"' ,103)
and
DATEPART(hh, b.datepushed) > Datepart(hh,'" + date_pushed + @"')
and
DATEPART(MI, b.datepushed) > Datepart(MI,'" + date_pushed + @"' )
and
DATEPART(ss, b.datepushed) > Datepart(ss,'" + date_pushed + @"' )
order by b.datepushed desc";
else
strQuery = @"
select
a.DLNO,
a.NAME,
b.TOPSTRING,
Convert(datetime,a.DOB,103) as DOB,
Convert(datetime,a.DOI,103) as DOI,
Convert(datetime,b.datepushed,103) as datepushed
from
PLInfo_Demo a,
DLInfo_Demo b
where
a.dlno=b.dlno ";
ds = DbManager.ExecuteSalarData(
strQuery,
CommandType.Text,
DbManager.strcon2,
null);
return ds;
}