求vb大神帮忙!!!
发表在VB答疑区
2013-07-19
是否精华
是
否
版块置顶:
是
否
[font color=#0000FF]编了一个用Access的程序,总是出错
[/font]
[u][font color=#0000FF]这部分是删除信息的窗体:
[/font][/u]
Private Sub Command2_Click()
Dim M1 As Integer
M1 = MsgBox("是否删除" & Text1.Text & "?", vbYesNo)
If M1 = vbYes Then
Dim rs As New ADODB.Recordset
[font color=#FF0000]在下面这句出错:
rs.Open "delete from xxtb where 编号 = '" + Text1.Text + "'cnn, adOpenKeyset, adLockOptimistic"
[/font]
Else
Text1.Text = ""
End If
End Sub
[u][font color=#0000FF]附:数据库连接模块
[/font][/u]
Public temp, str, BS As String
Public adoCon As New ADODB.Connection
Public adoRs As New ADODB.Recordset
Function cnn() As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Persist Security Info=False"
End Function
[/font]
[u][font color=#0000FF]这部分是删除信息的窗体:
[/font][/u]
Private Sub Command2_Click()
Dim M1 As Integer
M1 = MsgBox("是否删除" & Text1.Text & "?", vbYesNo)
If M1 = vbYes Then
Dim rs As New ADODB.Recordset
[font color=#FF0000]在下面这句出错:
rs.Open "delete from xxtb where 编号 = '" + Text1.Text + "'cnn, adOpenKeyset, adLockOptimistic"
[/font]
Else
Text1.Text = ""
End If
End Sub
[u][font color=#0000FF]附:数据库连接模块
[/font][/u]
Public temp, str, BS As String
Public adoCon As New ADODB.Connection
Public adoRs As New ADODB.Recordset
Function cnn() As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Persist Security Info=False"
End Function