datatype problem
-
TextBox2.Text = selectedDate.DayOfWeek.ToString(); TextBox3.Text = selectedDate.ToShortDateString(); DateTime sel = selectedDate.AddDays(7); TextBox2.Text = sel.ToShortDateString(); string connection2 = ConfigurationManager.AppSettings["conn"]; OleDbConnection con2 = new OleDbConnection(connection2); OleDbDataAdapter da_detail = new OleDbDataAdapter(); DataSet ds_detail = new DataSet(); con2.Open(); //da_detail.Fill(ds_detail, "details"); //DataTable detail_dt = ds_detail.Tables["details"]; string query = "select * from appointment where DATE >= " + selectedDate.ToShortDateString() + " AND DATE<= " + sel.ToShortDateString() + ""; OleDbCommand pay_cmd2 = new OleDbCommand(query, con2); //DataRow row = null; //OleDbCommand pay_cmd2 = new OleDbCommand(query, con2); da_detail.SelectCommand = pay_cmd2; da_detail.Fill(ds_detail, "details"); DataTable detail_dt = ds_detail.Tables["details"]; GridView1.DataSource = detail_dt; GridView1.DataBind(); am tryin this but no values are gettin selected.some problem wit the query.the values are in date/time format.plz help
-
TextBox2.Text = selectedDate.DayOfWeek.ToString(); TextBox3.Text = selectedDate.ToShortDateString(); DateTime sel = selectedDate.AddDays(7); TextBox2.Text = sel.ToShortDateString(); string connection2 = ConfigurationManager.AppSettings["conn"]; OleDbConnection con2 = new OleDbConnection(connection2); OleDbDataAdapter da_detail = new OleDbDataAdapter(); DataSet ds_detail = new DataSet(); con2.Open(); //da_detail.Fill(ds_detail, "details"); //DataTable detail_dt = ds_detail.Tables["details"]; string query = "select * from appointment where DATE >= " + selectedDate.ToShortDateString() + " AND DATE<= " + sel.ToShortDateString() + ""; OleDbCommand pay_cmd2 = new OleDbCommand(query, con2); //DataRow row = null; //OleDbCommand pay_cmd2 = new OleDbCommand(query, con2); da_detail.SelectCommand = pay_cmd2; da_detail.Fill(ds_detail, "details"); DataTable detail_dt = ds_detail.Tables["details"]; GridView1.DataSource = detail_dt; GridView1.DataBind(); am tryin this but no values are gettin selected.some problem wit the query.the values are in date/time format.plz help
This is a Repost. Why do you do this ?
Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
TextBox2.Text = selectedDate.DayOfWeek.ToString(); TextBox3.Text = selectedDate.ToShortDateString(); DateTime sel = selectedDate.AddDays(7); TextBox2.Text = sel.ToShortDateString(); string connection2 = ConfigurationManager.AppSettings["conn"]; OleDbConnection con2 = new OleDbConnection(connection2); OleDbDataAdapter da_detail = new OleDbDataAdapter(); DataSet ds_detail = new DataSet(); con2.Open(); //da_detail.Fill(ds_detail, "details"); //DataTable detail_dt = ds_detail.Tables["details"]; string query = "select * from appointment where DATE >= " + selectedDate.ToShortDateString() + " AND DATE<= " + sel.ToShortDateString() + ""; OleDbCommand pay_cmd2 = new OleDbCommand(query, con2); //DataRow row = null; //OleDbCommand pay_cmd2 = new OleDbCommand(query, con2); da_detail.SelectCommand = pay_cmd2; da_detail.Fill(ds_detail, "details"); DataTable detail_dt = ds_detail.Tables["details"]; GridView1.DataSource = detail_dt; GridView1.DataBind(); am tryin this but no values are gettin selected.some problem wit the query.the values are in date/time format.plz help
Wrap your date strings in hashes:
string query = "select * from appointment where DATE >= #" + selectedDate.ToShortDateString() + "# AND DATE<= #" + sel.ToShortDateString() + "#";
I would really advise you to write parameterized queries, though. Read up on it.
var question = (_2b || !(_2b));
-
Wrap your date strings in hashes:
string query = "select * from appointment where DATE >= #" + selectedDate.ToShortDateString() + "# AND DATE<= #" + sel.ToShortDateString() + "#";
I would really advise you to write parameterized queries, though. Read up on it.
var question = (_2b || !(_2b));
string query = "select * from appointment where DATE >'" + selectedDate.ToShortDateString() + "' AND DATE<'" + sel.ToShortDateString() + "'";