IF RC.EOF=false then 提示运行到此行时提示,对象关闭时,不允许进行操作!)
Private Sub Command1_Click()Dim Rs As New ADODB.Recordset
Dim Conn As New ADODB.Connection
Dim Ssql As String
Conn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;pwd=sa;Initial Catalog=vb;Data Source=LPLBOKE"
Ssql = "select * from xscj where id='" & Text3.Text & "'"
If Rs.EOF = False Then(运行到此行时提示,对象关闭时,不允许进行操作!)
MsgBox "学生编码重复,请修改编码!"
Else
Ssql = "insert into xscj (name,stroe,id) values ('" & Trim(Text1.Text) & "','" & Trim(Text2.Text) & "','" & Text3.Text & "')"
Rs.Open Ssql, Conn
MsgBox "添加成功!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
End Sub