title: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
body: <p>I am getting the following error "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value." and the date format is "DD/MM/YY"</p>
  
  <pre><code>    public DataSet GetSynchronizeDataForDLDocs(string date_pushed)
  {
      DataSet ds = new DataSet();
      string strQuery=string.Empty;
  
      if (date_pushed != null &amp;&amp; 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) &gt; CONVERT(varchar,'" + date_pushed + @"' ,103)
              and 
                  DATEPART(hh, b.datepushed) &gt; Datepart(hh,'" + date_pushed + @"') 
              and
                  DATEPART(MI, b.datepushed) &gt; Datepart(MI,'" + date_pushed + @"' ) 
              and
                  DATEPART(ss, b.datepushed) &gt; 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;
  }
  </code></pre>