首页 新闻 会员 周边 捐助

高手快进啊!着急啊!着火了啊

0
悬赏园豆:50 [已解决问题] 解决于 2009-07-08 11:21
<table border="0"> <tbody> <tr> <td>1</td> <td>UT13_B_01.36:</td> <td>2009-4-23</td> <td>18:33:16</td> </tr> <tr> <td>3</td> <td>UT13_B_01.36:</td> <td>2009-4-23</td> <td>18:33:13</td> </tr> <tr> <td>4</td> <td>UT13_B_01.36:</td> <td>2009-4-23</td> <td>18:33:15</td> </tr> <tr> <td>5</td> <td>UT13_B_01.36:</td> <td>2009-4-23</td> <td>18:33:17</td> </tr> <tr> <td>6</td> <td>UT13_B_01.36:</td> <td>2009-4-23</td> <td>18:33:19</td> </tr> <tr> <td>7</td> <td>UT13_B_01.36:</td> <td>2009-4-23</td> <td>18:33:21</td> </tr> <tr> <td>8</td> <td>UT13_B_01.36:</td> <td>2009-4-23</td> <td>18:33:23</td> </tr> <tr> <td>9</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:24</td> </tr> <tr> <td>10</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:25</td> </tr> <tr> <td>11</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:26</td> </tr> <tr> <td>12</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:27</td> </tr> <tr> <td>13</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:28</td> </tr> <tr> <td>14</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:34</td> </tr> <tr> <td>15</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:36</td> </tr> <tr> <td>16</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>9:00:00</td> </tr> <tr> <td>17</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>9:01:01</td> </tr> <tr> <td>18</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>9:02:02</td> </tr> <tr> <td>19</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>9:03:03</td> </tr> <tr> <td>20</td> <td>UT13_B_01.36:</td> <td>2009-4-24</td> <td>18:33:45</td> </tr> </tbody> </table> <p>&nbsp;</p> <p>ID, UT, Dates,DatesTime.</p> <p>分别是我数据库的字段名。我想获取2009-4-23 18:33:16到 2009-4-24 09:02:02之间的数据,不知道怎样获取?我数据库中记录的条数是不固定的。日期也是不是就隔一天的,只有时间是固定的。不知道哪位高手可以帮忙吗?谢谢了!&nbsp;</p>
Wennie的主页 Wennie | 初学一级 | 园豆:55
提问于:2009-07-07 17:42
< >
分享
最佳答案
0

string str1 = this.txtStartDate.Text.ToString();
string str2 = this.txtEndDate.Text.ToString();
string str3 = this.txtStartTimes.Text.ToString();//eg,"16:32:23"
string str4 = this.txtEndTimes.Text.ToString(); // eg,"09:00:00"
string sql = string.format("select * from WorkEffict where (Dates>#{0} {2}# and Dates<#{1} {3}#) and (format(Dates, \"hh:mm:ss\") >=#{2}# or format(Dates, \"hh:mm:ss\") <=#{3}#)", str1, str2, str3, str4);

你可以参考下

邀月 | 高人七级 |园豆:25475 | 2009-07-07 18:09
其他回答(2)
0

select * from 表 where DatesTime>=' 2009-4-23 18:33:16' and DatesTime<='2009-4-24 09:02:02'

就是这个?..得到该时间段内的数据吗?

邢少 | 园豆:10926 (专家六级) | 2009-07-07 18:12
0

难道不是这样吗?

SELECT * FROM DB WHERE (DATES > '2009/04/23' AND DATETIME > '18:33:16') AND (DATES < '2009/04/24' AND DATETIME < '09:02:02')

laaaaaa | 园豆:241 (菜鸟二级) | 2009-07-07 18:20
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册