Manj N

Manj N

  • NA
  • 148
  • 90.5k

The conversion of a varchar data type to a datetime data typ

Jul 24 2013 7:38 AM
error is=>The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.


String queryconnect;
            String DeveloperId;
            GridView1.Visible = true;
            Panel1.Visible = true;
            lblhours.Visible = true;
            queryconnect = "Select Id FROM TblTeam WHERE FirstName='" + User.Identity.Name + "'";
            DeveloperId = QR.SelectQry(queryconnect);
            queryconnect = "SELECT TblProjects.ProjectName,TblActivityMaster.Activity,TimeSheetBreakDown.Description,TimeSheetBreakDown.AdditionalDescription,";
            queryconnect += "TimeSheetBreakDown.Hour,TblWeek.WeekDay,CONVERT(varchar(10),TimeSheetBreakDown.date,103) as Date";
            queryconnect += " FROM  TimeSheetBreakDown INNER JOIN TblActivityMaster ON TimeSheetBreakDown.Activity = TblActivityMaster.Id ";
            queryconnect += " INNER JOIN TblProjects ON TimeSheetBreakDown.ProjectId = TblProjects.ProjectId";
            queryconnect += " INNER JOIN TblWeek ON TimeSheetBreakDown.Day=TblWeek.SlNo";
            queryconnect += " WHERE (TimeSheetBreakDown.DevId='" + DeveloperId + "') AND TimeSheetBreakDown.date >= '" + strstartdate + "' and TimeSheetBreakDown.date <= '" + strendate + "'";
            queryconnect += " and TblProjects.ProjectName='" + strprojectname + "'";
            queryconnect += " ORDER BY TblWeek.SlNo,TblProjects.ProjectName,TblActivityMaster.Activity";
            GridView1.DataSource = QR.DS(queryconnect);

strstartdate=22-07-2013
strenddate=24-07-2013
[CONVERT(varchar(10),TimeSheetBreakDown.date,103) as Date] is in the format yyyy/mm/dd



Answers (2)