三层独栋别墅:会VB地帮忙看看。

来源:百度文库 编辑:高校问答 时间:2024/04/28 04:29:33
Dim conn1 As New ADODB.Connection
Dim rs1 As New ADODB.Recordset

Private Sub Form_Load()
On Error GoTo fcf
conn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\MCtrl\Application\MCtrl.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False"
conn1.Open
sql = "select * from MCarbProfile where substring(NoBatch,2,10)='1-2004-04-29-02'"
MsgBox sql
conn1.Execute ("select * from MCarbProfile where substring(NoBatch,2,10)='1-2004-04-29-02'")
Exit Sub
fcf:
MsgBox Err.Description
End Sub

我想执行这个语句怎么执行不了?????
select * from MCarbProfile where substring(NoBatch,2,10)='1-2004-04-29-02'")

conn1.Execute ("select * from MCarbProfile where substring(NoBatch,2,10)='1-2004-04-29-02'")
这句 话改为
coon1.Execute(sql)

coon1.open(sql)