| | |
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
![]() |
Hi Raghu,
Add References
Microsoft ActiveX Data Object Library 2.0 to ur project
Connection To Oracle is :
To Execute the SQWL Statement :
I hope it is clear.
If u have any problems, let me know
Regards
Veena
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)
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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
sSQL="Update MyTable Set MyField = '" & Text1.Text & "' Where MyPK = 20" adoCn.Execute sSQL
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
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
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
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
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
Regards
Dev
![]() |
Similar Threads
- How to connect Oracle database from JSP page (Java)
- how to connect oracle 8i database with jsp page (JSP)
- oracle or sql server2000, which is best? (Oracle)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Stopping a shape after 5 seconds of moving
- Next Thread: checkbox control macro in excel 2007
Views: 5881 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






