Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. datatype problem

datatype problem

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ankitjain1110
    wrote on last edited by
    #1

    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

    V G 2 Replies Last reply
    0
    • A ankitjain1110

      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

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      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/

      1 Reply Last reply
      0
      • A ankitjain1110

        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

        G Offline
        G Offline
        Greg Chelstowski
        wrote on last edited by
        #3

        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));

        R 1 Reply Last reply
        0
        • G Greg Chelstowski

          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));

          R Offline
          R Offline
          Robert_Pan
          wrote on last edited by
          #4

          string query = "select * from appointment where DATE >'" + selectedDate.ToShortDateString() + "' AND DATE<'" + sel.ToShortDateString() + "'";

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups