home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / Code / ch33 / PlatVB_5_28_1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-08  |  2.0 KB  |  69 lines

  1. VERSION 5.00
  2. Begin VB.Form PlatVB_5_28_1 
  3.    Caption         =   "Visual Basic ADO Demonstration 1"
  4.    ClientHeight    =   1215
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4725
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   1215
  10.    ScaleWidth      =   4725
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton Command3 
  13.       Caption         =   "Next"
  14.       Height          =   375
  15.       Left            =   2400
  16.       TabIndex        =   3
  17.       Top             =   720
  18.       Width           =   2175
  19.    End
  20.    Begin VB.CommandButton Command1 
  21.       Caption         =   "First"
  22.       Height          =   375
  23.       Left            =   120
  24.       TabIndex        =   2
  25.       Top             =   720
  26.       Width           =   2175
  27.    End
  28.    Begin VB.TextBox Text2 
  29.       Height          =   435
  30.       Left            =   2400
  31.       TabIndex        =   1
  32.       Text            =   "Text2"
  33.       Top             =   120
  34.       Width           =   2175
  35.    End
  36.    Begin VB.TextBox Text1 
  37.       Height          =   435
  38.       Left            =   120
  39.       TabIndex        =   0
  40.       Text            =   "Text1"
  41.       Top             =   120
  42.       Width           =   2175
  43.    End
  44. Attribute VB_Name = "PlatVB_5_28_1"
  45. Attribute VB_GlobalNameSpace = False
  46. Attribute VB_Creatable = False
  47. Attribute VB_PredeclaredId = True
  48. Attribute VB_Exposed = False
  49. Option Explicit
  50. Dim RS As Recordset
  51. Public Sub Command1_Click()
  52.     RS.MoveFirst
  53.     Text1.Text = RS.Fields(1)
  54.     Text2.Text = RS.Fields(2)
  55. End Sub
  56. Private Sub Command3_Click()
  57.     RS.MoveNext
  58.     Text1.Text = RS.Fields(1)
  59.     Text2.Text = RS.Fields(2)
  60. End Sub
  61. Public Sub Form_Load()
  62.     Dim conn As ADODB.Connection
  63.     Set conn = CreateObject("ADODB.Connection")
  64.     conn.Open "DSN=PlatVB5;SERVER=SoftCoyote;UID=sa;PWD=wlfhwlfh"
  65.     Set RS = conn.Execute("SELECT * FROM MyTable")
  66.     Text1.Text = RS.Fields(1)
  67.     Text2.Text = RS.Fields(2)
  68. End Sub
  69.