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
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
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
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
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.