944,031 Members | Top Members by Rank

Ad:
Nov 29th, 2006
0

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

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gurutheja is offline Offline
3 posts
since Nov 2006
Nov 30th, 2006
0

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

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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Nov 30th, 2006
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gurutheja is offline Offline
3 posts
since Nov 2006
Nov 30th, 2006
0

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

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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Dec 2nd, 2006
0

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

Hi,
thank you very much veena if any further query i wil get back to you.

Regards
Raghu
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gurutheja is offline Offline
3 posts
since Nov 2006
Jan 28th, 2009
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
afreaz is offline Offline
1 posts
since Jan 2009
Jan 28th, 2009
0

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

How about starting a new thread, and not responding to one that is like, 3 years old?
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Jan 30th, 2009
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jikraant is offline Offline
1 posts
since Jan 2009
Dec 18th, 2009
0

mr. azizul

i get this messege
ora-12154: tns:could not resolve service name
Azizul
Reputation Points: 10
Solved Threads: 0
Newbie Poster
azizulkhn is offline Offline
1 posts
since Dec 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Stopping a shape after 5 seconds of moving
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: checkbox control macro in excel 2007





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC