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

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2006
Posts: 3
Reputation: gurutheja is an unknown quantity at this point 
Solved Threads: 0
gurutheja gurutheja is offline Offline
Newbie Poster

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

 
0
  #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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

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

 
0
  #2
Nov 30th, 2006
Hi Raghu,

Add References
Microsoft ActiveX Data Object Library 2.0 to ur project

Connection To Oracle is :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim adoCn As New ADODB.Connection
  2. Dim sSQL as String
  3. Dim RST As New AdoDb.RecordSet
  4.  
  5. sSQL= "Provider=MSDAORA.1;Password=MyPwd;" _
  6. & " User ID=MyUserName;Data Source=MyDataSource;" _
  7. & " Persist Security Info=True"
  8. With adoCn
  9. .CursorLocation = adUseClient
  10. .ConnectionString = DBStrCnct
  11. .ConnectionTimeout = 30
  12. .Open
  13. End With
  14.  
  15. To Open A Record Set Use This Statement :
  16.  
  17. sSQL = "Select * From MyTable"
  18. Set RST = Nothing
  19. RST.Open sSQl, adoCn, adOpenDynamic, adLockOptimistic
  20. '
  21. If Not (RST.EOF And RST.BOF) Then
  22. 'Records Present Do ur Coding here
  23. Else
  24. 'Records Not present
  25. End If
To Execute the SQWL Statement :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. sSQL="Update MyTable Set MyField = '" & Text1.Text & "' Where MyPK = 20"
  2. adoCn.Execute sSQL
I hope it is clear.
If u have any problems, let me know

Regards
Veena
Last edited by Narue; Jan 30th, 2009 at 10:07 am. Reason: added code tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 3
Reputation: gurutheja is an unknown quantity at this point 
Solved Threads: 0
gurutheja gurutheja is offline Offline
Newbie Poster

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

 
0
  #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 Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

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

 
0
  #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 Quick reply to this message  
Join Date: Nov 2006
Posts: 3
Reputation: gurutheja is an unknown quantity at this point 
Solved Threads: 0
gurutheja gurutheja is offline Offline
Newbie Poster

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

 
0
  #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 Quick reply to this message  
Join Date: Jan 2009
Posts: 1
Reputation: afreaz is an unknown quantity at this point 
Solved Threads: 0
afreaz afreaz is offline Offline
Newbie Poster

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

 
0
  #6
Jan 28th, 2009
plz dear help me out am also struck with same prob..
am new to VB so write it in detail for me plz..
help me out
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

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

 
0
  #7
Jan 28th, 2009
How about starting a new thread, and not responding to one that is like, 3 years old?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1
Reputation: jikraant is an unknown quantity at this point 
Solved Threads: 0
jikraant jikraant is offline Offline
Newbie Poster

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

 
0
  #8
Jan 30th, 2009
create a odbc for the database , table you would like to connect to, then invoke vb select either standard / data project , go to add in visual data manager , and build a form using the odbc , in the data control connect(property) you will get connection string if you would like to use it further for queries...
Regards
Dev
Reply With Quote Quick reply to this message  
Join Date: Dec 2009
Posts: 1
Reputation: azizulkhn is an unknown quantity at this point 
Solved Threads: 0
azizulkhn azizulkhn is offline Offline
Newbie Poster

mr. azizul

 
0
  #9
6 Days Ago
i get this messege
ora-12154: tns:could not resolve service name
Azizul
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 5881 | Replies: 8
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC