This question already has an answer here:
这个问题在这里已有答案:
- Displaying selected values only in VB6 1 answer
- 仅在VB6 1答案中显示所选值
I want my program to show only the active students that are in the database. If the student has Archived as No, it shows them, but if the student has Yes, it hides them. Every time I play the program, it shows me the error in Adodc1.Refresh
:
我希望我的程序只显示数据库中的活跃学生。如果学生已存档为否,则显示它们,但如果学生有,则隐藏它们。每次我播放该程序时,它都会向我显示Adodc1.Refresh中的错误:
Syntax error in FROM clause.
FROM子句中的语法错误。
Code:
码:
Dim sql As String
connSearch.Open connstr
Adodc1.ConnectionString = conn.connstr
sql = "select * from Table1 where [Archived] <> 'NO'"
Adodc1.RecordSource = sql
Set StudentTable.DataSource = Adodc1
Adodc1.Refresh ''''The error is in this line.''''
Adodc1.Visible = False
1 个解决方案
#1
1
I fixed the problem, i needed adcmdText in the code for it to work. Thankyou Microsoft Help https://support.microsoft.com/en-us/kb/238279
我修复了问题,我需要在代码中使用adcmdText才能使用它。谢谢你的Microsoft帮助https://support.microsoft.com/en-us/kb/238279
Dim sql As String
sql = "select * from Table1 where [Active] <> 'No'"
Adodc1.ConnectionString = conn.connstr
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Set StudentTable.DataSource = Adodc1
Adodc1.Refresh
Adodc1.Visible = False
#1
1
I fixed the problem, i needed adcmdText in the code for it to work. Thankyou Microsoft Help https://support.microsoft.com/en-us/kb/238279
我修复了问题,我需要在代码中使用adcmdText才能使用它。谢谢你的Microsoft帮助https://support.microsoft.com/en-us/kb/238279
Dim sql As String
sql = "select * from Table1 where [Active] <> 'No'"
Adodc1.ConnectionString = conn.connstr
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Set StudentTable.DataSource = Adodc1
Adodc1.Refresh
Adodc1.Visible = False