i have the following error in the code. please help me solve it

Server Error in '/Project' Application.
--------------------------------------------------------------------------------

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

Source Error:


Line 35:
Line 36: DataSet ds = new DataSet();
Line 37: da.Fill(ds);
Line 38: GridView1.DataSource = ds;
Line 39: GridView1.DataBind();

Source File: c:\Users\Shoaib\Desktop\Project\Admin.aspx.cs Line: 37

And the code is as given below:

Collapse | Copy Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

public partial class Admin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GridView1.Visible = true;
}
string connStr = ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString;

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
TextBox1.Text = Calendar1.SelectedDate.ToShortDateString();
Calendar1.Visible = false;
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Calendar1.Visible = true;
}
protected void Button1_Click(object sender, EventArgs e)
{

SqlConnection con = new SqlConnection(connStr);
SqlDataAdapter da = new SqlDataAdapter("select UserName, LoginTime, LogoutTime, Upload UploadFile, Download DownloadFile from logindata where ltrim(rtrim(str(month(logintime))))+ '/' + ltrim(rtrim(str(day(logintime)))) + '/' + ltrim(rtrim(str(year(logintime)))) ='" + TextBox1.Text + "'", con);
//+ "+ Convert.ToDateTime;.Convert.ToDateTime (TextBox1.Text), con);
//Where Logintime='"+TextBox1.Text+"'", con);

DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.Visible = true;
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{

GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
GridView1.Visible = true;

}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}