Visual Basic
Database connectivity
Steps
Start Programs Microsoft Visual Studio Microsoft Visual Basic File New project StandardEXE Place the required controls in the form.
Steps
Steps
Add ADO control thro Project Components
Steps
Add the ADODC control to form.
Steps
Right click on the control properties Build ADODC
Steps
Now select provider for Oracle
Steps
Enter username and password Connection OK Test
Steps
Copy the Connection String and use it while coding
Steps
Write coding for each command button
Code
Dim con As [Link] Dim rs As New [Link] Private Sub Form_Load() Set con = New [Link] Set rs = New [Link] [Link] ("Provider=MSDAORA.1;User ID=scott;Password=tiger;Persist Security Info=False") [Link] "select * from dept", con, adOpenDynamic, adLockOptimistic [Link] = rs("deptno") [Link] = rs("dname") [Link] = rs("loc") End Sub Underlined text is the connection String copied .. Type password manually.. Now the ADODB control in form can be removed
Code
Private Sub Command3_Click() [Link] [Link] = rs("deptno") [Link] = rs("dname") [Link] = rs("loc") End Sub Private Sub Command4_Click() [Link] [Link] = rs("deptno") [Link] = rs("dname") [Link] = rs("loc") End Sub
Code
Private Sub Command3_Click() [Link] [Link] = rs("deptno") [Link] = rs("dname") [Link] = rs("loc") End Sub Private Sub Command4_Click() [Link] [Link] = rs("deptno") [Link] = rs("dname") [Link] = rs("loc") End Sub
Code
Private Sub Command5_Click() Set con = New [Link] Set rs = New [Link] [Link] ("Provider=MSDAORA.1;User ID=scott;Password=tiger;Persist Security Info=False") [Link] "insert into dept values(" & [Link] & ",'" & [Link] & "','" & [Link] & "')", con, adOpenDynamic, adLockBatchOptimistic [Link] MsgBox "record inserted" End Sub