我在设计查询窗体时遇到问题。问题是在TextBox1 和TextBox2输入日期时为什么查不到数据?代码:
sql = "select * from wsjl where 日期 between" & TextBox1.Text & " AND " & TextBox2.Text
adpter. = sql
ds.Clear()
adpter.Fill(ds, "wsjl")
试一试:
sql="select * from wsjl where 日期 between '" & TextBox1.Text & "' And '" & TextBox2.Text & "'"
adpter. = sql
ds.Clear()
adpter.Fill(ds, "wsjl")
/pa?p=1:123440016:10" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://wpa./pa?p=1:123440016:10');}" onmousewheel="return imgzoom(this);" alt="" />/msgrd?V=1&Uin=123440016&Site=im.&Menu=yes" target="_blank">点击这里给我发消息
sql = "select * from wsjl where 日期 between '" & TextBox1.Text & "' AND '" & TextBox2.Text&"'"
adpter. = sql
ds.Clear()
adpter.Fill(ds, "wsjl")
如果数据库是mssql那就对了
如果是ACCESS数据库就要改为
sql = "select * from wsjl where 日期 between #" & TextBox1.Text & "# AND #" & TextBox2.Text &"#"
adpter. = sql
ds.Clear()
adpter.Fill(ds, "wsjl")