by Ariesme (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 17th December 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
A simple but powerfull tool to access various details about users in Oracle 8.0
API Declarations
'please mail me because it is the only thing i want from users of this code
'http://www17.brinkster.com/ariesme"
'*******************************************
'no need to add reference of ADODB
'tested for oracle 8.0
'*******************************************
Dim oracn
Dim cn
Dim res
Private Sub Command1_Click()
On Error GoTo er
If Len(List1.List(List1.ListIndex)) = 0 Then
MsgBox "Select a user name", vbInformation, "Error"
Exit Sub
End If
If Len(Trim(Text1)) = 0 Then
MsgBox "Enter password", vbInformation, "Error"
Exit Sub
End If
List2.Clear
Set oracn = CreateObject("ADODB.connection")
Set res = CreateObject("ADODB.recordset")
oracn.Open "provider=msdaora.1;user id=" & Trim(List1.List(List1.ListIndex)) & ";password=" & Trim(Text1.Text)
res.CursorLocation = 3
Set res = oracn.execute("select * from tab")
res.MoveFirst
Do While Not res.EOF
List2.AddItem res.Fields(0).Value
res.MoveNext
Loop
Exit Sub
er:
Text2 = Err.Description
End Sub
'show user account details
Private Sub Command2_Click()
On Error GoTo er
If Len(List1.List(List1.ListIndex)) = 0 Then
MsgBox "Select a User name"
Exit Sub
End If
Dim st As String
st = ""
Set res = CreateObject("ADODB.recordset")
res.CursorLocation = 3
Set res = cn.execute("select * from dba_users where username='" & Trim(List1.List(List1.ListIndex)) & "'")
For n = 0 To res.Fields.Count - 1
st = st & res.Fields(n).Name & " = " & res.Fields(n).Value & vbCrLf
Next
MsgBox st
Exit Sub
er:
Text2 = Err.Description
End Sub
'Form load code
Private Sub Form_Load()
On Error GoTo er
Set cn = CreateObject("ADODB.connection")
Set res = CreateObject("ADODB.recordset")
cn.Open "provider=msdaora.1;user id=system;password=manager"
res.CursorLocation = 3
Set res = cn.execute("select * from dba_users order by username")
res.MoveFirst
Do While Not res.EOF
List1.AddItem res!username
res.MoveNext
Loop
Exit Sub
er:
Command1.Enabled = False
Command2.Enabled = False
Text2 = Err.Description
End Sub
'For GUI of form please add 2 command buttons ,2 textbox,3 lablels, and 2 listbox at form
'Plase don't change controls default name,otherwise you have to change the code
No comments have been posted about A simple but powerfull tool to access various details about users in Oracle 8.0. Why not be the first to post a comment about A simple but powerfull tool to access various details about users in Oracle 8.0.