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
Solved

how to add new data in vb using dao connection

Posted on 2001-07-08
6
248 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

828 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