home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fSQL
- BackColor = &H00C0C0C0&
- Caption = "SQL Statement"
- Height = 3000
- Icon = SQL.FRX:0000
- Left = 3630
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 2580
- ScaleMode = 0 'User
- ScaleWidth = 5268
- Top = 1230
- Width = 5370
- Begin CommandButton ExecuteSQLButton
- Caption = "&Execute SQL"
- Default = -1 'True
- Enabled = 0 'False
- Height = 374
- Left = 120
- TabIndex = 2
- Top = 121
- Width = 1327
- End
- Begin CommandButton ClearSQLButton
- Caption = "&Clear SQL"
- Height = 374
- Left = 1555
- TabIndex = 1
- Top = 121
- Width = 1327
- End
- Begin TextBox cSQLStatement
- Height = 1943
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- Top = 603
- Width = 5035
- End
- Option Explicit
- Sub ClearSQLButton_Click ()
- cSQLStatement = ""
- cSQLStatement.SetFocus
- End Sub
- Sub cSQLStatement_Change ()
- If cSQLStatement <> "" Then
- ExecuteSQLButton.Enabled = True
- Else
- ExecuteSQLButton.Enabled = False
- End If
- End Sub
- Sub ExecuteSQLButton_Click ()
- Dim RetSQL As Long
- If cSQLStatement = "" Then Exit Sub
- MsgBar "Executing SQL Statement", True
- SetHourGlass Me
- If UCase(Mid(cSQLStatement, 1, 6)) = "SELECT" Then
- On Error GoTo SQLDSErr
- gfFromSQL = True
- 'create a new dynaset form
- gstDynaString = ""
- If VDMDI.cSingleRecord = True Then
- Dim dsform1 As New fDynaset
- dsform1.Show
- Else
- Dim dsform2 As New fGridFrm
- dsform2.Show
- End If
- Else
- On Error GoTo SQLErr
- If UCase(Mid(cSQLStatement, 1, 4)) = "USE " Then
- Beep
- MsgBox "'Use' not allowed, try Open DataBase.", 48
- GoTo SQLEnd
- End If
- RetSQL = gCurrentDB.ExecuteSQL(cSQLStatement)
- If RetSQL > 0 Then
- If gfTransPending Then gfDBChanged = True
- End If
- MsgBox CStr(RetSQL) + " row(s) Affected by SQL Statement.", 48
- End If
- GoTo SQLEnd
- SQLErr:
- ShowError
- Resume SQLEnd
- SQLDSErr:
- Resume SQLEnd
- SQLEnd:
- ResetMouse Me
- MsgBar "", False
- End Sub
- Sub Form_Load ()
- Dim x As Integer
- cSQLStatement = GetINIString("SQLStatement", "")
- x = Val(GetINIString("SQLWindowHeight", "3000"))
- Height = x
- x = Val(GetINIString("SQLWindowWidth", "5370"))
- Width = x
- x = Val(GetINIString("SQLWindowTop", "0"))
- Top = x
- x = Val(GetINIString("SQLWindowLeft", CStr(fTables.Left + fTables.Width)))
- Left = x
- End Sub
- Sub Form_Resize ()
- If WindowState <> 1 Then
- cSQLStatement.Width = Width - 320
- cSQLStatement.Height = Height - 1150
- End If
- End Sub
- Sub Form_Unload (Cancel As Integer)
- Dim x As Integer
- Me.WindowState = 1
- Cancel = True
- End Sub
-