Login   Register  
PHP Classes
elePHPant
Icontem

File: Form1.frm

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Pablo Gazmuri  >  RemoteSQL  >  Form1.frm  >  Download  
File: Form1.frm
Role: Example script
Content type: text/plain
Description: Visual Basic Example Form
Class: RemoteSQL
Provides client-side access to server-side DB
Author: By
Last change:
Date: 11 years ago
Size: 3,568 bytes
 

Contents

Class file image Download
VERSION 5.00
Begin VB.Form frmMain 
   Caption         =   "Remote SQL Query Example"
   ClientHeight    =   6465
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9870
   LinkTopic       =   "Form1"
   ScaleHeight     =   6465
   ScaleWidth      =   9870
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox txtQuery 
      Height          =   285
      Left            =   840
      TabIndex        =   6
      Text            =   "select * from your-table"
      Top             =   1440
      Width           =   4575
   End
   Begin VB.ListBox lstResponse 
      Height          =   3570
      Left            =   240
      TabIndex        =   4
      Top             =   2640
      Width           =   9255
   End
   Begin VB.CommandButton cmdGetQuery 
      Caption         =   "Get Query"
      Height          =   495
      Left            =   7920
      TabIndex        =   3
      ToolTipText     =   "Send a query and retrieve results"
      Top             =   1320
      Width           =   1455
   End
   Begin VB.CommandButton cmdSendQuery 
      Caption         =   "Send Query"
      Height          =   495
      Left            =   7920
      TabIndex        =   2
      ToolTipText     =   "Execute a query without retrieving results"
      Top             =   480
      Width           =   1455
   End
   Begin VB.TextBox txtAddr 
      Height          =   285
      Left            =   840
      TabIndex        =   0
      Text            =   "http://www.your-domain.net/sql-link.php"
      Top             =   600
      Width           =   4575
   End
   Begin VB.Label Label3 
      Caption         =   "Your Query"
      Height          =   255
      Left            =   840
      TabIndex        =   7
      Top             =   1200
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "Reponse:"
      Height          =   255
      Left            =   240
      TabIndex        =   5
      Top             =   2400
      Width           =   2175
   End
   Begin VB.Label Label1 
      Caption         =   "HTTP Address of sql-link.php"
      Height          =   255
      Left            =   840
      TabIndex        =   1
      Top             =   360
      Width           =   2295
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

'****************************************************************
'Example usage of getquery and sendquery functions
'****************************************************************



Private Sub cmdGetQuery_Click()
On Error GoTo handler
lstResponse.Clear
    Dim resp() As String
    Dim row As Collection
    Dim strLine As String
    Dim i As Integer
    Dim x As Integer
    'use getquery for queries with result sets
    'like SELECT queries
    resp = getQuery(txtQuery, txtAddr)
    
    For x = 0 To UBound(resp, 1)
    strLine = vbNullString
        For i = 0 To UBound(resp, 2)
            strLine = strLine & resp(x, i) & " - "
        Next i
        lstResponse.AddItem (strLine)
    Next x
    Exit Sub
handler:
    If Err.Number <> 9 Then MsgBox "Error: " & Err.Description
End Sub

Private Sub cmdSendQuery_Click()
    lstResponse.Clear
    'use sendquery for queries with out result sets
    'like update or insert queries
    Call sendQuery(txtQuery, txtAddr)
End Sub