📄 formwiz.frm
字号:
Screen.MousePointer = vbDefault
End Sub
Private Sub ShowError()
Dim sSQL As String
On Error GoTo RDOError
sSQL = "Drop Table no_such_table"
cn.Execute sSQL
Exit Sub
RDOError:
DisplayRDOError
End Sub
Private Sub MultipleRS()
Dim ps As rdoPreparedStatement
Dim rs As rdoResultset
Dim sSQL As String
Screen.MousePointer = vbHourglass
List1.Clear
'Setup the two SELECT statements
sSQL = "Select au_lname From authors; "
sSQL = sSQL & "Select stor_name from stores "
Set ps = cn.CreatePreparedStatement("MultiRS", "")
ps.SQL = sSQL
ps.RowsetSize = 1
'Open the first RS
Set rs = ps.OpenResultset _
(rdOpenForwardOnly, rdConcurReadOnly)
List1.AddItem "Result set #1"
While Not rs.EOF
List1.AddItem rs(0)
DoEvents
rs.MoveNext
Wend
'The end of the first RS was reached
' Now open the 2nd RS
rs.MoreResults
List1.AddItem ""
List1.AddItem "Result set #2"
While Not rs.EOF
List1.AddItem rs(0)
DoEvents
rs.MoveNext
Wend
rs.Close
Screen.MousePointer = vbDefault
End Sub
Private Sub AsynchRSStart()
Dim sSQL As String
Screen.MousePointer = vbHourglass
sSQL = "Select * From authors "
'Start the Async query and move on
Set rsA = cn.OpenResultset(sSQL, rdOpenForwardOnly, _
rdConcurReadOnly, rdAsyncEnable)
Screen.MousePointer = vbDefault
End Sub
Private Sub SSCursor()
Dim rs As rdoResultset
Dim cl As rdoColumn
Dim sFixedString As String * 15
Dim sTextLine As String
Screen.MousePointer = vbHourglass
List1.Clear
' Use Server side cursor
en.CursorDriver = rdUseServer
Set rs = cn.OpenResultset _
("Select au_lname, au_fname From authors", rdOpenKeyset)
For Each cl In rs.rdoColumns
sFixedString = cl.Name
sTextLine = sTextLine & sFixedString & vbTab
Next
List1.AddItem sTextLine
DoEvents
Do Until rs.EOF
sTextLine = ""
For Each cl In rs.rdoColumns
sFixedString = cl.Value
sTextLine = sTextLine & sFixedString & vbTab
Next
List1.AddItem sTextLine
DoEvents
rs.MoveNext
Loop
Screen.MousePointer = vbDefault
End Sub
Private Sub AsynchRSFinish()
Dim sFixedString As String * 15
Dim sTextLine As String
Dim cl As rdoColumn
Screen.MousePointer = vbHourglass
List1.Clear
If rsA.StillExecuting = False Then
For Each cl In rsA.rdoColumns
sFixedString = cl.Name
sTextLine = sTextLine & sFixedString & vbTab
Next
List1.AddItem sTextLine
Do
sTextLine = ""
For Each cl In rsA.rdoColumns
sFixedString = cl.Value
sTextLine = sTextLine & sFixedString & vbTab
Next
List1.AddItem sTextLine
DoEvents
rsA.MoveNext
Loop Until rsA.EOF = True
rsA.Close
End If
Screen.MousePointer = vbDefault
End Sub
Private Sub Finish()
End Sub
Private Sub Reset()
'Close any open connections
cn.Close
en2.Close
en.Close
'Initialize the program control values
Label1.Visible = True
Label2.Visible = True
Label_Top.Visible = False
Text_Top.Visible = False
Label_Mid.Caption = "User ID"
Label_Mid.Visible = False
Text_Mid.Visible = False
Text_Mid.Enabled = True
Label_Bot.Caption = "Password"
Label_Bot.Visible = False
Text_Bot.Visible = False
Text_Bot.PasswordChar = "*"
Text_Top.Text = sServer
Text_Mid.Text = sLoginID
Text_Bot.Text = sPassword
Label1.Caption = sCase0_UpperText
Label2.Caption = sCase0_LowerText
End Sub
Private Sub Command_Next_Click()
Select Case nState
Case 1
InitRDO
nState = nState + 1
Label1.Visible = False
Label_Mid.Visible = True
Label_Bot.Visible = True
Text_Mid.Visible = True
Text_Bot.Visible = True
Label2.Caption = sCase1_LowerText
Case 2
Create2ndRDOEnv
nState = nState + 1
Label1.Visible = True
Label_Mid.Visible = False
Label_Bot.Visible = False
Text_Mid.Visible = False
Text_Bot.Visible = False
Label1.Caption = sCase2_UpperText
Label2.Caption = sCase2_LowerText
Case 3
OpenRDOConnectionDSN
nState = nState + 1
Label1.Visible = False
Label_Top.Visible = True
Label_Mid.Visible = True
Label_Bot.Visible = True
Text_Top.Visible = True
Text_Mid.Visible = True
Text_Bot.Visible = True
Label2.Caption = sCase3_LowerText
Case 4
sServer = Text_Top.Text
sLoginID = Text_Mid.Text
sPassword = Text_Bot.Text
OpenRDOConnectionNoDSN
nState = nState + 1
sServer = Text_Top.Text
sLoginID = Text_Mid.Text
sPassword = Text_Bot.Text
Label1.Visible = True
Label_Top.Visible = False
Label_Mid.Visible = False
Label_Bot.Visible = False
Text_Top.Visible = False
Text_Mid.Visible = False
Text_Bot.Visible = False
Label1.Caption = sCase4_UpperText
Label2.Caption = sCase4_LowerText
Case 5
RDOQuery
nState = nState + 1
Label1.Visible = False
List1.Visible = True
Label2.Caption = sCase5_LowerText
Case 6
nState = nState + 1
Label1.Visible = False
List1.Visible = False
Label_Mid.Caption = "Enter the state ID"
Label_Mid.Visible = True
Text_Mid.Text = "CA"
Text_Mid.Visible = True
Label2.Caption = sCase6_LowerText
Case 7
RDOQueryPS
nState = nState + 1
List1.Visible = True
Label_Mid.Visible = False
Text_Mid.Visible = False
Label2.Caption = sCase7_LowerText
Case 8
CreateTable
nState = nState + 1
List1.Visible = False
Label1.Visible = True
Label1.Caption = sCase8_UpperText
Label2.Caption = sCase8_LowerText
Case 9
AddUsingCursor
nState = nState + 1
Label1.Caption = sCase9_UpperText
Label2.Caption = sCase9_LowerText
Case 10
UpdateUsingCursor
nState = nState + 1
Label1.Caption = sCase10_UpperText
Label2.Caption = sCase10_LowerText
Case 11
DeleteUsingCursor
nState = nState + 1
Label1.Caption = sCase11_UpperText
Label2.Caption = sCase11_LowerText
Case 12
AddUsingInsert
nState = nState + 1
Label1.Caption = sCase12_UpperText
Label2.Caption = sCase12_LowerText
Case 13
UpdateUsingUpdate
nState = nState + 1
Label1.Caption = sCase13_UpperText
Label2.Caption = sCase13_LowerText
Case 14
DeleteUsingDelete
nState = nState + 1
Label1.Visible = False
Label_Mid.Visible = True
Label_Mid.Caption = "Enter the state code to query"
Text_Mid.Visible = True
Label_Bot.Visible = True
Label_Bot.Caption = "Number of occurances"
Text_Bot.Visible = True
Text_Bot.Text = ""
Text_Bot.PasswordChar = ""
Text_Bot.Enabled = False
Label2.Caption = sCase14_LowerText
Case 15
CallSP
nState = nState + 1
Label1.Caption = ""
Label2.Caption = sCase15_LowerText
Case 16
ShowError
nState = nState + 1
Label_Mid.Visible = False
Label_Bot.Visible = False
Text_Mid.Visible = False
Text_Bot.Visible = False
Label1.Visible = True
Label1.Caption = sCase16_UpperText
Label2.Caption = sCase16_LowerText
Case 17
MultipleRS
nState = nState + 1
List1.Visible = True
Label1.Visible = False
Label_Mid.Visible = False
Text_Mid.Visible = False
Label_Bot.Visible = False
Text_Bot.Visible = False
Label2.Caption = sCase17_LowerText
Case 18
AsynchRSStart
nState = nState + 1
List1.Visible = False
Label1.Visible = True
Label_Top.Visible = False
Label_Mid.Visible = False
Label_Bot.Visible = False
Text_Top.Visible = False
Text_Mid.Visible = False
Text_Bot.Visible = False
Label1.Caption = sCase18_UpperText
Label2.Caption = sCase18_LowerText
Case 19
SSCursor
nState = nState + 1
List1.Visible = True
Label1.Visible = False
Label_Top.Visible = False
Label_Mid.Visible = False
Label_Bot.Visible = False
Text_Top.Visible = False
Text_Mid.Visible = False
Text_Bot.Visible = False
Label2.Caption = sCase19_LowerText
Case 20
AsynchRSFinish
nState = nState + 1
List1.Visible = True
Label1.Visible = False
Label_Top.Visible = False
Label_Mid.Visible = False
Label_Bot.Visible = False
Text_Top.Visible = False
Text_Mid.Visible = False
Text_Bot.Visible = False
Label2.Caption = sCase20_LowerText
Case 21
Finish
nState = nState + 1
List1.Visible = False
Label1.Visible = True
Label_Top.Visible = False
Label_Mid.Visible = False
Label_Bot.Visible = False
Text_Top.Visible = False
Text_Mid.Visible = False
Text_Bot.Visible = False
Label1.Caption = sCase21_UpperText
Label2.Caption = sCase21_LowerText
Case 22
Reset
nState = 1
End Select
End Sub
Private Sub Form_Load()
'Initialize the program control values
nState = 1
List1.Visible = False
Label_Top.Visible = False
Text_Top.Visible = False
Label_Mid.Visible = False
Text_Mid.Visible = False
Label_Bot.Visible = False
Text_Bot.Visible = False
Label1.Caption = sCase0_UpperText
Label2.Caption = sCase0_LowerText
End Sub
Private Sub DisplayRDOError()
Dim er As RDOError
For Each er In rdoErrors
MsgBox "Number: " & er.Number & vbCrLf & _
"SQL State: " & er.SQLState & vbCrLf & _
"Text: " & er.Description
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
en2.Close
en.Close
Set en2 = Nothing
Set en = Nothing
End Sub
Private Sub Command_Cancel_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -