VB系统提示:实时错误3131 FROM子句语法错误。提示黄色在是17行,请高手指导错误出在哪里

时间:2023-01-19 02:14:42

1  Private Sub CmdSelect_Click() 查询

2  Dim str As String, chk As String

3  ***.enabled = False

4  ***.enabled = False

5  ***.enabled = False

6  ***.enabled = False

7  ***.enabled = True

8  ***.enabled = False

9  ***.enabled = False

10  chk = InputBox("输入查询条件:例如 姓名=“叶枫”", "查询")

11  If chk = "" Then Exit Sub 输入零长度(直接按【enter】则退出

12  str = "select StuID,StuName,StuSex,StuBirthDate,StuClass,StuFrom,StuTtuTel"

13  str = str & " from StuInfo wherehere StuName=" & "" & chk & """构成 SQL字符串"

14  ***.connect = "Access"                                                          

15  ***.databasename = "C:\Program Files (x86)\Microsoft Visual Studio\VB98\***.mdb"

16  ***.recordsource = str 记录源来自SQL查询                                      指定要连接的数据库

17  ***.refresh 控件刷新

18  If data1.***.eof And data1.***.bof Then

19  Exit Sub

20  End If

21  ***.datafield = "StuID"

22  ***.datafield = "StuName"

23  ***.datafield = "StuSex"

24  ***.datafield = "StuBirthDate"

25  ***.datafield = "StuClass"

26  ***.datafield = "StuFrom"

27  ***.datafield = "StuTel"

28  End Sub

最佳答案

你的SQL语句有个明显的错

frehere ....

这里的wherehere应该是where

若还有其它错,可能就是程序中表字段与数据库中不