Solved

how to add new data in vb using dao connection

Posted on 2001-07-08
6
250 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 50 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

688 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