?
Solved

how to add new data in vb using dao connection

Posted on 2001-07-08
6
Medium Priority
?
251 Views
Last Modified: 2012-08-13
i want to know how to connect vb with oracle using dao connection and vb codes for adding data deleting modification etc please tell me the codes.
0
Comment
Question by:aliamirkhan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 7

Accepted Solution

by:
Inteqam earned 200 total points
ID: 6262575
    ' DAO Example (Data Access Objects)  
      Dim wstemp As Workspace
      Dim dbtemp As Database
      Dim rstemp As Recordset
     
      Set wstemp = DBEngine.Workspaces(0)
      Set dbtemp = wstemp.OpenDatabase("", False, False, "ODBC;DSN=Oracle;USR=scott;PWD=tiger")
      Set rstemp = dbtemp.OpenRecordset(myquery.Text, dbOpenDynaset, dbSQLPassThrough)
     howmany = 0
      Combo1.Clear
      Do Until rstemp.EOF
           msgbox rstemp(0)
          rstemp.MoveNext
          howmany = howmany + 1
      Loop

     ' DAO Example (Data Access Objects)
      Dim contemp As New rdoConnection
      Dim rstemp As rdoResultset
      Dim envtemp As rdoEnvironment
      Set envtemp = rdoEngine.rdoEnvironments(0)
      envtemp.CursorDriver = rdUseServer
      ' or rdUseOdbc, rdUseNone, rdUseIfNeeded, rdUseClientBatch
      With contemp
        .Connect = "ODBC;DSN=Oracle;USR=scott;PWD=tiger"
         .EstablishConnection rdDriverNoPrompt, false, rdoForwardOnly
        ' or rdoStatic, rdoKeyset, rdoDynamic
       End With

     Set rstemp = contemp.OpenResultset("select ...") ' Your SQL here
End If

     howmany = 0
     With rstemp
     Do Until .EOF Or howmany > 2000
        msgbox .rdoColumns(0)
        ' Give a message box of the 1st column
        .MoveNext
        howmany = howmany + 1
        Loop
       
     ADO Example
     dim conn as ADODB.Connection
     dim rs as recordset
     Conn.Open "...", "...", "..."
     '           ^DSN   ^User  ^Password
     Set RS = Conn.Execute( "SELECT * FROM theTable" )
     do while not rs.eof
        msgbox RS(i).Value
        rs.movenext
     loop

Set RDODatabase = rdoEnvironments(0).OpenConnection("", rdDriverNoPrompt, True, "") Set RDOResultSet = RDODatabase.OpenResultset(SqlString.Text) TxtNumRows.Text = RDOResultSet.RowCount
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 6262577
0
 
LVL 1

Expert Comment

by:vim_asteya
ID: 6263722
same as Integam,that should work
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:aliamirkhan
ID: 6265407
i have to run the program and see.But i think the code is correct
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 6265431
did it work, i didn't try it neither.

thanks anyway.
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 6265437
and welcome to Ex-Ex
:o)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question