User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 397,804 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,508 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 3198 | Replies: 4
Reply
Join Date: Nov 2006
Posts: 3
Reputation: gurutheja is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gurutheja gurutheja is offline Offline
Newbie Poster

Help let me know d steps to connect to oracle(sql) from vb6

  #1  
Nov 29th, 2006
hi
i am Raghavendra. I dont know anything abt how to connect to oracle (sql) from VB 6 . could u plz let me know d steps n d code for executing the queries. its very urgent plz let me know
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2006
Posts: 709
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 95
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: let me know d steps to connect to oracle(sql) from vb6

  #2  
Nov 30th, 2006
Hi Raghu,

Add References
Microsoft ActiveX Data Object Library 2.0 to ur project

Connection To Oracle is :

Dim adoCn As New ADODB.Connection
Dim sSQL as String
Dim RST As New AdoDb.RecordSet

sSQL= "Provider=MSDAORA.1;Password=MyPwd;" _
& " User ID=MyUserName;Data Source=MyDataSource;" _
& " Persist Security Info=True"
With adoCn
.CursorLocation = adUseClient
.ConnectionString = DBStrCnct
.ConnectionTimeout = 30
.Open
End With

To Open A Record Set Use This Statement :

sSQL = "Select * From MyTable"
Set RST = Nothing
RST.Open sSQl, adoCn, adOpenDynamic, adLockOptimistic
'
If Not (RST.EOF And RST.BOF) Then
'Records Present Do ur Coding here
Else
'Records Not present
End If



To Execute the SQWL Statement :

sSQL="Update MyTable Set MyField = '" & Text1.Text & "' Where MyPK = 20"
adoCn.Execute sSQL


I hope it is clear.
If u have any problems, let me know

Regards
Veena
Reply With Quote  
Join Date: Nov 2006
Posts: 3
Reputation: gurutheja is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gurutheja gurutheja is offline Offline
Newbie Poster

Re: let me know d steps to connect to oracle(sql) from vb6

  #3  
Nov 30th, 2006
hi veena,
Thank u very much, but i am not getting to know how to select or add oledb or activex and all those intial procedures before doing the coding. If u could plz help me as i know nothin about vb, i have an interview and they asked me for the database connectivity.
Regards
Raghu
Reply With Quote  
Join Date: Nov 2006
Posts: 709
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 95
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: let me know d steps to connect to oracle(sql) from vb6

  #4  
Nov 30th, 2006
Hi,

No Need To add any Active x or oledb control.

Just add the References in Project Menu.
Microsoft ActiveX Data Object Library 2.0

Place Text1, Text2 TextBoxes on the Form.
Change DatabaseName, UserID and Password according to ur connections.
In Form Level After the Option Explicit type this

Dim adoCn As New ADODB.Connection
Dim sSQL as String
Dim RST As New AdoDb.RecordSet

In Form Load

Private Sub Form_Load()
sSQL= "Provider=MSDAORA.1;Password=MyPwd;" _
& " User ID=MyUserName;Data Source=MyDataSource;" _
& " Persist Security Info=True"
With adoCn
.CursorLocation = adUseClient
.ConnectionString = DBStrCnct
.ConnectionTimeout = 30
.Open
End With

'
sSQL = "Select * From MyTable"
Set RST = Nothing
RST.Open sSQl, adoCn, adOpenDynamic, adLockOptimistic
'
If Not (RST.EOF And RST.BOF) Then
RST.MoveFirst
Text1.Text = RST(0)
Text2.Text = RST(1)
End If
RST.Close
Set RST= Nothing

End Sub


Thats ALL.


Regards
Veena
Reply With Quote  
Join Date: Nov 2006
Posts: 3
Reputation: gurutheja is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gurutheja gurutheja is offline Offline
Newbie Poster

Re: let me know d steps to connect to oracle(sql) from vb6

  #5  
Dec 2nd, 2006
Hi,
thank you very much veena if any further query i wil get back to you.

Regards
Raghu
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 6:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC