SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Mar 2002
    Location
    Bangalore,Karnataka,India
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Connecting To Oracle

    I have to test an application Using TestPartner. The Back End being Oracle 8.1.7 and frontend power builder
    Now after adding a record through front end i have to check if it has updated the database
    can someone pass me the code of how to connect to a table and populate the values in the variables ?
    thanks in advance
    my id is prasadjahagirdar@yahoo.com
    regards
    prasad

    ------------------

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Dublin, Ireland
    Posts
    139
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Connecting To Oracle

    Hi Prasad,

    Here's a simple example that uses ADO/ODBC to connect to an Oracle database and return the number of items in a database table:

    'Define the database name and login (ensure you have an Oracle ODBC connection on your machine set up)
    Public Const strCurrentDatabase As String = "DSN=;UID=;PWD=;DATABASE="

    Dim iCount As Integer

    iCount = DBCount(Table Name)

    Connect to ODBC Database using ADO
    Function ADOConnect(ADOC As ADODB.Connection)
    'ADOC: ADO Connection to Open.

    'Declare ADO Connection
    Dim adoC1 As ADODB.Connection

    'Create New ADO Connection
    Set adoC1 = New ADODB.Connection

    'Open ADO Connection to ODBC database - Current Database is Defined Globally
    adoC1.Open strCurrentDatabase
    Set ADOC = adoC1

    End Function


    'Tidy Up ADO Connections
    Function ADOTidyUp(ADOConnect As ADODB.Connection, ADORecord As ADODB.Recordset)
    'ADOConnection: ADO Connection to Close.
    'ADORecordSet: ADO RecordSet to Close.

    'Close ADO Connections
    ADORecord.Close
    ADOConnect.Close

    End Function


    'Count Number of Items In Database Table using ADO and ODBC.
    Function DBCount(strTableName As String)
    'strTableName: Name of the database table in which to count items.

    'Declare ADO Connection & RecordSet
    Dim adoConn As ADODB.Connection
    Dim adoRs As ADODB.Recordset

    'Connect to ODBC Database using ADO
    ADOConnect adoConn

    'Build SQL Query
    Dim strQuery As String
    strQuery = "Select count(*) from " & strTableName

    'Execute SQL Query & Assign to ADO RecordSet
    Set adoRs = adoConn.Execute(strQuery)

    'Return Result from RecordSet (First Column in ADO RecordSet)
    DBCount = adoRs.Fields.Item(0)

    'Tidy Up
    ADOTidyUp adoConn, adoRs

    End Function

    Cheers,

    Ross.


    ------------------
    Ross Ryan
    rossryan@ireland.com
    Ross

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:28 AM.

Copyright BetaSoft Inc.