修改查询结果
代码:Private Sub Command1_Click()Dim Conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim connect As String
connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=jchisn;Data Source=JXJXYY1"
Set Conn = New ADODB.Connection
Conn.Open connect
Dim SQL As String
If Text1.Text <> "" Then
SQL = " Select * from InPatient where outsign=1 and hoscode= '" & Trim(Text1.Text) & "'"
Set rs = New ADODB.Recordset
rs.Open SQL, Conn, adOpenStatic
Set DataGrid1.DataSource = rs
End If
With DataGrid1
Label2.Caption = rs.Fields(3)
End With
End Sub
Private Sub Command2_Click()
Execute "update InPatient set outsign=0 where outsign=1 and hoscode= '" & Trim(Text1.Text) & "'""
End Sub
出现错误信息‘424
请问Command2这样定对吗?要如何修改呢?