sql 语句未正常运行
sql statement is not functioning properly
我写了一个 sql
声明,允许我从 Datagrid
中删除学生。我想改变它,以便它将除两个字段之外的所有值更改为 0,当我尝试这样做时它给我这个错误:
Synatx error in UPDATE statement.
这是原始代码:
sql = "update Table1 set [Active] = 'No' where ID =" & SID
这是我修改的:
sql = "update Table1 set [Mark 1 ENG], [Mark 2 ENG] {removed the others so it does not get clustered} = '0' where ID =" & SID
If YNResponse = vbYes Then
sql = "update Table1 set [Mark 1 ENG], [Mark 2 ENG] = '0' where ID =" & SID 'find the student and delete them
If CurrentCon.State = adStateOpen Then
CurrentCon.Close
End If
CurrentCon.Open
CurrentCon.Execute sql
Adodc1.ConnectionString = Conn.connstr
Adodc1.CommandType = adCmdText
Set StudentTable.DataSource = Adodc1
CurrentCon.Close
CurrentCon.Open
Adodc1.Refresh
frmStudents.Adodc1.Recordset.Sort = "[ID] "
这就是问题所在
sql = "update Table1 set [Mark 1 ENG], [Mark 2 ENG] = '0' where ID =" & SID 'find the student and delete the
应该在哪里
update table1 set [Mark 1 ENG] = 0, [Mark 2 ENG] = 0
我写了一个 sql
声明,允许我从 Datagrid
中删除学生。我想改变它,以便它将除两个字段之外的所有值更改为 0,当我尝试这样做时它给我这个错误:
Synatx error in UPDATE statement.
这是原始代码:
sql = "update Table1 set [Active] = 'No' where ID =" & SID
这是我修改的:
sql = "update Table1 set [Mark 1 ENG], [Mark 2 ENG] {removed the others so it does not get clustered} = '0' where ID =" & SID
If YNResponse = vbYes Then
sql = "update Table1 set [Mark 1 ENG], [Mark 2 ENG] = '0' where ID =" & SID 'find the student and delete them
If CurrentCon.State = adStateOpen Then
CurrentCon.Close
End If
CurrentCon.Open
CurrentCon.Execute sql
Adodc1.ConnectionString = Conn.connstr
Adodc1.CommandType = adCmdText
Set StudentTable.DataSource = Adodc1
CurrentCon.Close
CurrentCon.Open
Adodc1.Refresh
frmStudents.Adodc1.Recordset.Sort = "[ID] "
这就是问题所在
sql = "update Table1 set [Mark 1 ENG], [Mark 2 ENG] = '0' where ID =" & SID 'find the student and delete the
应该在哪里
update table1 set [Mark 1 ENG] = 0, [Mark 2 ENG] = 0