Contact Form

Name

Email *

Message *

Wednesday, September 18, 2013

Data Base Class ADODB Command Recordset vb6



Data Base Class ADODB Command Recordset VB6 ADO FILE HANDLING OPEN

Introduction
This is Basically a Database class. In this project we connect to sql server 2000. We insert, update, delete and select queries. And also fill the grid with out using any data control. In this project i also use file handling.
Using the Code
First create the private member of the class. The three member of the class.

Option Explicit
Public oConn As ADODB.Connection
Public rsXData As ADODB.Recordset

1.  ADODB.connection This is for initialize the ADODB connection. This object use to connect the data base. 
2.  ADODB.Recordset 
This is for initialize the Recordset. This object for multiple purpose, but generally this object for collecting  the rows and fields. 

Public Sub opendb()
 On Error GoTo err1:
        Dim txtdbfile As String
        Dim txtpassword As String
        Dim Filename As String
        Filename = "" & App.Path & "\Label.txt"
        Open (Filename) For Input As #1
        Line Input #1, txtdbfile
        Line Input #1, txtpassword
 Close #1
        Set oConn = New ADODB.Connection
        Set rsXData = New ADODB.Recordset
        oConn.CursorLocation = adUseClient
        oConn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
                   "Data Source=" & App.Path & "" & txtdbfile & "" & _
                   ";Jet OLEDB:Database Password=" & txtpassword & ";"
err1:
Close #1
       Exit Sub
End Sub
 

0 comments:

Post a Comment