Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I want to connect a Oracle Da

Status
Not open for further replies.

geetapm

Programmer
Feb 12, 2002
17
IN
Hi

I want to connect a Oracle Database thru VB
by ADODB connection.

I've used

Dim Conn As ADODB.Connection
Dim ObjRec As ADODB.Recordset

Private Sub Form_Load()
Set Conn = New ADODB.Connection
Set ObjRec = New ADODB.Recordset
Conn.open "DSN=misuat;UID=misuat;PWD=misuat007;"
ObjRec.ActiceConnection = Conn
ObjRec.open "select lkm_id from lookup_master"
While Not ObjRec.EOF
Debug.Print ObjRec("lkm_id") & " "
Debug.Print &quot;<br>&quot;
ObjRec.MoveNext
Wend
ObjRec.Close
Conn.Close
End Sub

I'm getting error Undefined Data Type.

can anyone help me.

Thanx.
 
this is an example from one of our projects. it is a large db application and this is only a sample of some code. put this in the general declarations
Code:
Public cn As New ADODB.Connection
Public cnStr As String
Public rsCounty As New ADODB.Recordset

then this goes in a subroutine (the login id and password variables are set in a form):

Code:
cnStr = &quot;Provider=MSDAORA.1;Password=&quot; & varPASSWORD & &quot;;User ID=&quot; & varSYSTEM_USERID & &quot;;Data Source=yoda;Persist Security Info=True&quot;

Set cn = New ADODB.Connection
     .CursorLocation = 3  '3 = adUseServer
     .Open cnStr
End With

'Create query string for rsCounty
    qryLUCounty = &quot;SELECT * from LU_COUNTY order by COUNTY_NAME&quot;

'Open County recordset
    With rsCounty
      .Open qryLUCounty, cn, adOpenStatic, adLockOptimistic
    End With

'move to first record and populate a combo list w/county names
    rsCounty.MoveFirst
    Do Until rsCounty.EOF
        cmbOwnerRegEntCounty2.AddItem rsCounty!County_Name
        rsCounty.MoveNext
    Loop

hope this helps some
 
Hi,

Where did the error come from? what line? Did you add the Microsoft ActiveX Data Object 2.X Library?

 
I tried this code, modified for my circumstances and I get &quot;Invalid attribute in Sub or Function.&quot;

At work, I will need to do this in Oracle but at home I'm just testing it on an Access database. I changed the cnStr setting to the path on my C: drive to the database. I also changed the query to work with my table/columns. What am I doing wrong?

Appreciate any help you can give.

-Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top