Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Dear sir/mam

I am shailendra singh new in .net . I don't solve problem . How can match date database table date and text date . how can possible .But now I am using following query and code button click .
Da = new SqlDataAdapter("select * from tblorder where bookingdate='txtform.text'",con1);
DataTable dt = new DataTable();
Da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
Posted
Updated 27-Mar-11 19:25pm
v2

You should use SqldataReader
SqlCommand cmd = new SqlCommand("select * from Table1",conObject);
            SqlDataReader dr = cmd.ExecuteReader();
            dr.Read();
            if (TextBox1.Text == dr.GetString(0)) // 0 is 1st column
            { 
             //Do as your wish
            }}
 
Share this answer
 
Comments
Bhavna v 29-Mar-11 0:03am    
you should use dr.GetDateTime() intead of GetString();
I forget to mention quotes:
Da = new SqlDataAdapter("select * from tblorder where bookingdate='" + txtform.text + "'",con1);
 
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