「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;
}