•
•
•
•
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
![]() |
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
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
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
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
- 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: query run successfully in sql*plus but return 0 records affected in vb6
- Next Thread: veena and other people again help


Linear Mode