学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
轻松建立自己的群组,招兵买马   
发新话题
打印

修改查询结果

修改查询结果

代码: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这样定对吗?要如何修改呢?

TOP

多个  "  吧

TOP

不是这个的原因,请再帮个忙看一看。

TOP

加個Conn 再把"去掉試試
[fly]烈焰照耀世界,斌冻冻千万里.[/fly]

TOP

修改后:
Conn.Execute "update InPatient set outsign=0 where outsign=1 and hoscode= '" & Trim(Text1.Text) & "'"
错误信息:
要求对象
请各位再帮我看一看

TOP

谢了,已解决

TOP

发新话题