Solved

how to add new data in vb using dao connection

Posted on 2001-07-08
6
249 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS expression Issue finding a string 10 101
TT Auto Dashboard 13 101
how to Classify of email (pdf attachments) 7 50
which modules are active in VB6 project? 6 52
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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