'那么我的SQL语句怎么写呢:select name where time????? where 后面的time的条件语句该怎么写呢。
'那么我的SQL语句怎么写呢:select name where time????? where 后面的time的条件语句该怎么写呢。
info表
name time 小花 2005-6-7 21:19:56 假设你的数据表如上 我只能用程序取出
dim dt as datatable=new datatable() dim mydc as datacolumn=new datacolunm()
mydc.colunmnname="name" mydc.datatype=system.type.gettype("system.string") mydc.allownull=false dt.columns.add(mydc)
mydc=new datacolunm() mydc.colunmnname="time" mydc.datatype=system.type.gettype("system.datetime") mydc.allownull=false dt.columns.add(mydc)
dim sql as string dim connstr dim myconn as sqlconnection dim myda as sqldataadapter dim ds as new dataset()
myconn=new sqlconnection(connstr) myconn.open
sql="select [name], [time] from info" myda=new sqldataadapter(sql,myconn) myda.fill(ds,"my")
dim i as integer dim mydate as datetime dim myrow as datarow dim myname as string for i = 0 to ds.tables("my").rows.count-1 myname=ds.tables("my").rows.item(i).item("name") mydate= ds.tables("my").rows.item(i).item("time") if formatdatetime(mydate,3)< formatdatetime("2005-6-7 8:00:00",3) and formatdatetime(mydate,3)> formatdatetime("2005-6-7 9:00:00",3) then myrow=dt.newrow() myrow.item("name")=myname myrow.item("time")=mtdate dt.rows.add(myrow) end if next
'//返回一个dataview可以直接绑定 dim mydataview as dataview mydataview=new dataview(dt) 不知道对不对 没有运行过