-1
我已經寫了一個sql
聲明,它允許我從Datagrid
中刪除學生。我想改變這種因此它的變化,除了兩個字段爲0,所有的值,當我試圖做到這一點它給了我這個錯誤:sql語句無法正常工作
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] "