Click here to Skip to main content
15,912,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I am using asp.net 2.0 with C#.

In Asp.net I am using one textbox for input for date based on enter date.

I have to display the records in a gridview but it is giving null result

Can you correct my code which helps me?


I am having the table with fields.

TblDetails
========
Notes nvarchar(50)
ItemKeyName nvarchar(50)
time1 datetime (data is stored in dd/MM/yyyy)



protected void Button1_Click(object sender, EventArgs e)
{
SqlDataAdapter da = new SqlDataAdapter("select * from TblDetails where time1='"+Convert.ToDateTime(TextBox1.Text)+"'",con) ;

DataSet ds = new DataSet();
da.Fill(ds, "t");
GridView2.DataSource = ds.Tables["t"];
GridView2.DataBind();

}
Posted
Updated 10-Jul-10 21:16pm
v2

1 solution

If you are looking at only date then maybe this[^] can give you a hint as to where you might be making a mistake.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900