急死了就差一点了!大家快帮忙呀!!!
Option Explicit
Dim Mycn As New ADODB.Connection '数据库连接对象,用于打开数据库
Dim Myrs1 As New ADODB.Recordset '记录集对象,用于存入记录的
Private Sub Command1_Click()
Dim cnstring As String '用于存放连接字符串的
cnstring = "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=dytd;PassWord=dytd;Data Source=dytd"
Mycn.Open cnstring
Mycn.CursorLocation = adUseClient
If Option1.Value = True Then
If Text1.Text = "" Then
MsgBox "请正确填写申请书编号!", vbOKOnly + vbExclamation, "信息提示"
Exit Sub
Else
Myrs1.Open "select * from DJ_CSDJ_TDDJSQS where DCT_BH='" & Trim(Text1) & "'", Mycn
If Myrs1.BOF And Myrs1.EOF Then
MsgBox "不存在申请书编号!!!", vbOKOnly + vbExclamation, "信息提示"
Text1 = ""
Text1.SetFocus
Myrs1.Close
Set Myrs1 = Nothing
Mycn.Close
Exit Sub
End If
MSHFlexGrid1.Clear
TableInit
MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1
MSHFlexGrid1.Row = MSHFlexGrid1.Rows - 1
MSHFlexGrid1.Col = 0
MSHFlexGrid1.Text = Myrs1.Fields("DCT_BH") & ""
MSHFlexGrid1.Col = 1
.....................
Myrs1.Close
Set Myrs1 = Nothing
Else
Mycn.Close '关闭连接对象
Set Mycn = Nothing
Myrs1.Close
Set Myrs1 = Nothing
Exit Sub
Mycn.Close
End If
Mycn.Close
.............
在后面加
If Option2.Value = True Then
怎样写代码呀!就差一点就好了!!!快帮忙呀!
昨天兰色情调大哥的代码也没通过!今天再帮我改改!!!