vb对象打开时不允许操作 5
2个回答
展开全部
没有及时的关闭rs对象,给你改了一下,你再试试
Dim SQL As String
Dim S As String
Dim flag1 As Integer
Dim flag2 As Integer
Private Sub Command1_Click()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\小程序\db1.mdb;Persist Security Info=False"
S = Text1.Text
If Text1.Text = "" Then
MsgBox "请输入用户名!", vbInformation, "消息提醒"
Else
SQL = "Select * From 用户信息表 where 名称='" & S & "'"
Rs.Open SQL, Conn, 1, 3
If Rs.EOF Then
MsgBox "此用户数据库中不存在,请重新输入!", vbExclamation, "消息提醒"
Else
If Rs.Fields(2) > 100 Then
MsgBox "老大先还债吧!", vbInformation, "消息提醒"
Else
If (Rs.Fields(2) < 100& & Rs.Fields(2) > 30) Then
flag1 = 1
If (Rs.Fields(2) < 30) Then
flag1 = 0
End If
End If
End If
End If
Rs.Close
End If
S = Text3.Text
SQL = "Select * From 库存文件 where 名称='" & S & "'"
Rs.Open SQL, Conn, 1, 1
If Text3.Text = "" Then
MsgBox "请输入零件名!", vbInformation, "消息提醒"
Rs.Close
Else
Rs.Close
SQL = "Select * From 库存文件 where 名称='" & S & "'"
Rs.Open SQL, Conn, 1, 1
If Rs.EOF Then
MsgBox "此零件数据库中不存在,请重新输入!", vbExclamation, "消息提醒"
Else
If (Val(Text2.Text) > Rs.Fields(2)) Then
flag2 = 1
Else
flag2 = 0
End If
End If
End If
If (flag1 = 1& & flag2 = 1) Then
MsgBox "不好意思,不发货!", vbInformation, "消息提醒"
If (flag1 = 1& & flag2 = 0) Then
MsgBox "先还债吧,不然不发货哦!", vbInformation, "消息提醒"
If (flag1 = 0& & flag2 = 1) Then
MsgBox "先按库存发吧,有多少发多少!", vbInformation, "消息提醒"
If (flag1 = 0& & flag2 = 0) Then
MsgBox "发货!马上!", vbInformation, "消息提醒"
End If
End If
End If
End If
End Sub
满意请采纳。
Dim SQL As String
Dim S As String
Dim flag1 As Integer
Dim flag2 As Integer
Private Sub Command1_Click()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\小程序\db1.mdb;Persist Security Info=False"
S = Text1.Text
If Text1.Text = "" Then
MsgBox "请输入用户名!", vbInformation, "消息提醒"
Else
SQL = "Select * From 用户信息表 where 名称='" & S & "'"
Rs.Open SQL, Conn, 1, 3
If Rs.EOF Then
MsgBox "此用户数据库中不存在,请重新输入!", vbExclamation, "消息提醒"
Else
If Rs.Fields(2) > 100 Then
MsgBox "老大先还债吧!", vbInformation, "消息提醒"
Else
If (Rs.Fields(2) < 100& & Rs.Fields(2) > 30) Then
flag1 = 1
If (Rs.Fields(2) < 30) Then
flag1 = 0
End If
End If
End If
End If
Rs.Close
End If
S = Text3.Text
SQL = "Select * From 库存文件 where 名称='" & S & "'"
Rs.Open SQL, Conn, 1, 1
If Text3.Text = "" Then
MsgBox "请输入零件名!", vbInformation, "消息提醒"
Rs.Close
Else
Rs.Close
SQL = "Select * From 库存文件 where 名称='" & S & "'"
Rs.Open SQL, Conn, 1, 1
If Rs.EOF Then
MsgBox "此零件数据库中不存在,请重新输入!", vbExclamation, "消息提醒"
Else
If (Val(Text2.Text) > Rs.Fields(2)) Then
flag2 = 1
Else
flag2 = 0
End If
End If
End If
If (flag1 = 1& & flag2 = 1) Then
MsgBox "不好意思,不发货!", vbInformation, "消息提醒"
If (flag1 = 1& & flag2 = 0) Then
MsgBox "先还债吧,不然不发货哦!", vbInformation, "消息提醒"
If (flag1 = 0& & flag2 = 1) Then
MsgBox "先按库存发吧,有多少发多少!", vbInformation, "消息提醒"
If (flag1 = 0& & flag2 = 0) Then
MsgBox "发货!马上!", vbInformation, "消息提醒"
End If
End If
End If
End If
End Sub
满意请采纳。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询