Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2002
    Location
    India
    Posts
    11

    Unhappy Unanswered: need help and fast

    hey everybody
    i am working on project in which i am using vb and oracle 8i.....
    i have a text-box in vb in which if the user types in a name i want the other text box to get the corresponding name from oracle table....
    i know how to connect oracle and vb...but the quyery execution for a text-box i am finding it difficut...plz tell me abt this and also how to execute queries which retuen a single value that i can place in text-box.
    plzz help me real soon..
    sairam

  2. #2
    Join Date
    Mar 2002
    Location
    Santos - SP - Brazil
    Posts
    13

    Re: need help and fast

    Hi SairamP,

    Try to read something about ADO, and Recordset and Connection, this information can be found in the URL www.msdn.com

    In following a sample in vb of a query which return a single value, i hope this can help you.

    Dim RS as ADODB.RECORDSET
    Dim db As ADODB.Connection

    Connect = "Provider=XXX;Password=XXX;User ID=XXX;Data Source=XXX;Persist Security Info=True"

    DB.ConnectionString = Connect
    DB.Open

    Rs.ActiveConnection = DB.connect
    rs.Open "select ..."
    do until rs.EOF
    TEXT1.TEXT = RS.Fields(0)
    rs.MOVENEXT
    loop

    Regards Rafael,

    Originally posted by SairamP
    hey everybody
    i am working on project in which i am using vb and oracle 8i.....
    i have a text-box in vb in which if the user types in a name i want the other text box to get the corresponding name from oracle table....
    i know how to connect oracle and vb...but the quyery execution for a text-box i am finding it difficut...plz tell me abt this and also how to execute queries which retuen a single value that i can place in text-box.
    plzz help me real soon..
    sairam

  3. #3
    Join Date
    Feb 2002
    Location
    India
    Posts
    11
    thanks Rafael......sometimes the recordset eof and bof do throw up some errors............anyways if i make a project of the program i am developing using vb and oracle will the user who runs it need oracle and will he have the power to see the database if he is an oracle developer

  4. #4
    Join Date
    Mar 2002
    Location
    Santos - SP - Brazil
    Posts
    13
    Hi SairamP,

    The user need to have the Oracle Client in his workstation, and you can see the database normally, because the application is different but the database is the same.
    Do you understand ?


    Rafael.

  5. #5
    Join Date
    Feb 2002
    Location
    India
    Posts
    11
    hii RAfael..tnakx for taking pains to reply to my question..but i just cant help them..they keep popping one by one...when i insert records in the table using rs.execute where rs is the recordset the recordset inserts the data in the table but doesnt get refreshed i.e the changes are not visible immediately....i am using the provider msdasql...i can see the insertion in oracle immediately but not in the recordset..the record count doesnt get updated immediately too...is there a fuction in ADO like the one in DAO like data_reposition so that i can show the position(count) as to where the user is in table....
    thanks once again...hoping for ur invaluable reply...
    sairamP

  6. #6
    Join Date
    Jan 2002
    Posts
    28
    Sriram,

    When you use rs.execute() which will take the result and put it in yr buffer (client) and the update the database when you issue the update command. for refreshing the data you can add the item in the recordset or you have to execute the recordset to get the updated value( which will in turn takes the latest record from the database..)

    good luck...

    raju

  7. #7
    Join Date
    Mar 2002
    Location
    Santos - SP - Brazil
    Posts
    13
    Hi SairamP,

    Raju is right in his solution, but i think that is more easy to use the RESYNC method in recordset
    This Method Refreshes the data in the current Recordset object from the underlying database.
    In following a sample that i get in MSDN documentation, i hope this help you.

    '=============
    Public Sub ResyncX()

    Dim strCnn As String
    Dim rstTitles As ADODB.Recordset

    ' Open connections.
    strCnn = "Provider=sqloledb;" & _
    "Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "

    ' Open recordset for titles table.
    Set rstTitles = New ADODB.Recordset
    rstTitles.CursorType = adOpenStatic
    rstTitles.LockType = adLockBatchOptimistic
    rstTitles.Open "titles", strCnn, , , adCmdTable

    ' Change the type of the first title in the recordset.
    rstTitles!Type = "database"

    ' Display the results of the change.
    MsgBox "Before resync: " & vbCr & vbCr & _
    "Title - " & rstTitles!Title & vbCr & _
    "Type - " & rstTitles!Type

    ' Resync with database and redisplay results.
    rstTitles.Resync
    MsgBox "After resync: " & vbCr & vbCr & _
    "Title - " & rstTitles!Title & vbCr & _
    "Type - " & rstTitles!Type

    rstTitles.CancelBatch
    rstTitles.Close

    End Sub
    '=============
    Regards,

    Rafael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •