数据库里面的 uptime 时段 存储的时间为 2011年5月26日sql语句——select * from tb_files where Uptime between '2011年05月11日' and '2011年05月27日'问题 查询不了数据?
请问是我sql语句错误了么 也没有报错啊

解决方案 »

  1.   

    '2011年05月11日'  在数据库   不是datatime类型转换一下吧
      

  2.   

    请教大家,我有个随机的问题,我刚在学.net程序,有下到一个源码,就是随机抽取考卷的,下面是随机的,但是我想把随机改成不随机的,就是自动抽取前20条,排他们最开始的的输入顺序排列,该怎么样呢?谁能解答下:下面是部分代码,请问要改哪些?
    tx_extime.Value = Kminfo[3];
      string lst = roandow_data(mySet.Tables[0].Rows.Count, int.Parse(Kminfo[1]));
      txID.Text = lst;
      txVuale.Text = Kminfo[2];
      string[] lsts=lst.Split(';');
      for (int i=0;i<lsts.Length;i++)
      {
      Table ntb = new Table();
      TD1.Controls.Add(ntb);
      TableRow ntr = new TableRow();
      ntb.Controls.Add(ntr);
      TableCell ntc = new TableCell();
      ntr.Controls.Add(ntc);
      Label nlb = new Label();
      nlb.Font.Bold = true;
      nlb.Font.Size = 11;
      nlb.Text = (i+1).ToString() + "、" + mySet.Tables[0].Rows[int.Parse(lsts[i])]["q_question"].ToString();
      ntc.Controls.Add(nlb);
      ntr = new TableRow();
      ntb.Controls.Add(ntr);
      ntc = new TableCell();
      ntr.Controls.Add(ntc);
      RadioButtonList nrbl = new RadioButtonList();
      for (char ia = 'A'; ia <= 'D'; ia++)
      {
      ListItem li = new ListItem();
      li.Text = ia.ToString() + "、" + mySet.Tables[0].Rows[int.Parse(lsts[i])]["q_key" + ia.ToString()].ToString();
      li.Value = ia.ToString();
      nrbl.Items.Add(li);
      }
      nrbl.ID = "q_" + mySet.Tables[0].Rows[int.Parse(lsts[i])]["q_id"].ToString();
      ntc.Controls.Add(nrbl);
      }
      Button1.Visible = true;
      }
      private string roandow_data(int allcount, int thecount)
      {
      Random rnd = new Random();
      List<int> lst = new List<int>();
      int i = 0;
      string str = "";
      while (i < thecount)
      {
      int j = rnd.Next(allcount);
      if (lst.IndexOf(j) == -1)
      {
      lst.Add(j);
      i++;
      }
      }
      foreach (int j in lst)
      {
      if (str.Length == 0)
      {
      str = j.ToString();
      }
      else
      {
      str = str + ";" + j.ToString();
      }
      }
      return str;
      

  3.   

    where replace(replace(REPLACE(Uptime,'年','-'),'月','-'),'日','')
          between '2011-05-11' and '2011-05-27'
      

  4.   

    我在取值的时候 DateTime.Parse(textdate.text.tirm().tostring()); 还是不行 数据库的字段转换下再看看
      

  5.   

    你先看看写入数据库的Uptime 的字段的类型,在传值的时候就传如何数据库一样的类型即可。
      

  6.   

    我用的是My97DatePicker 控件 取值时候 取得是'2011年05月11日'  数据库修改后存的是'2011-05-11
    '  现在 是取值  怎么 取来和数据库一直呢