错误:语法错误(操作符丢失在'起点="起点"and'终点='终点'),请问怎么回事?错在哪里?

星星点灯&一路向前 2003-05-18 10:21:35
a: If txtqidian.Text = "" Then txtqidian.Text = "起点"
If txtzhongdian.Text = "" Then txtzhongdian.Text = "终点"

qidian = txtqidian.Text
zhongdian = txtzhongdian.Text

sql_qidian = "起点='" & qidian & "' and "
sql_zhongdian = "终点='" & zhongdian & "'"

If qidian = "起点" Then qidian = ""
If zhongdian = "终点" Then zhongdian = "'"

sql_chaxun = "select * from gongjiaoluxian where " & sql_qidian & sql_zhongdian & "order by 时间权重"

Adodc1.RecordSource = sql_chaxun
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
Adodc1.Refresh
txtcount.Text = DataGrid1.ApproxCount
Exit Sub
...全文
19 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hdj0569 2003-05-18
  • 打赏
  • 举报
回复
引号好像不配对
chenyu5188 2003-05-18
  • 打赏
  • 举报
回复
Adodc1.RecordSource = sql_chaxun
Adodc1.refresh'要刷新一下控件
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
txtcount.Text = DataGrid1.ApproxCount
Exit Sub
syszj 2003-05-18
  • 打赏
  • 举报
回复
If txtqidian.Text = "" Then txtqidian.Text = "起点"
If txtzhongdian.Text = "" Then txtzhongdian.Text = "终点"

qidian = txtqidian.Text
zhongdian = txtzhongdian.Text

If qidian = "起点" Then qidian = ""
If zhongdian = "终点" Then zhongdian = ""

sql_chaxun = "select * from gongjiaoluxian where 起點='" & qidian & "' and 終點='" & zhongdian & "' order by 时间权重"
有一點疑問就是你用到order by,那*代表的是gongjiaoluxian 中所有的字段這樣是不對的.

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧