Hey all,
So hopefully this is a quick fix but for the life of me I can't figure out how to get my results from a OracleDataReade r record set.
Just trying to get all the users for a specific TNS into an array. I was able to do this easily before with ADODB, but thought I would try using ODP.net.
Here is what I have so far and it definitely gets all the USERs for a given TNS. its when I get to the READ() part where the syntax is ???
'TNSname, User and password are all variables declared before this
/CODE
Dim oradb As String = "Data Source=" & TNSname & ";User Id=" & User & ";Password= " & password & ";" ' Visual Basic
Dim Inconn As New OracleConnectio n(oradb) ' Visual Basic
Inconn.Connecti onString = oradb
Inconn.Open()
Dim sql As String = "SELECT USERNAME FROM dba_users where default_tablesp ace != 'SYSAUX' and default_tablesp ace != 'SYSTEM' and default_tablesp ace != 'TOOLS' and default_tablesp ace != 'USERS' ORDER BY USERNAME" ' Visual Basic
Dim cmd As New OracleCommand(s ql, Inconn)
cmd.CommandType = CommandType.Tex t
Dim inRS As OracleDataReade r = cmd.ExecuteRead er()
Dim arrTemp() As String = {}
Dim i As Integer = 0
While inRS.Read()
arrTemp(i) = inRS.GetString( 0).ToString
i = i + 1
End While
inRS.Close()
Inconn.Close()
/CODE
Its strange as I can easily populate a text or combo box during the read by just saying
While inRS.Read()
cbo_test.items. add(inRS.Item(" USERNAME"))
End While
I would appreciate anyones thoughts and or direction here as I would rather not go back to ADOBD...
Thanks ahead of time!
Cheers,
Eric
So hopefully this is a quick fix but for the life of me I can't figure out how to get my results from a OracleDataReade r record set.
Just trying to get all the users for a specific TNS into an array. I was able to do this easily before with ADODB, but thought I would try using ODP.net.
Here is what I have so far and it definitely gets all the USERs for a given TNS. its when I get to the READ() part where the syntax is ???
'TNSname, User and password are all variables declared before this
/CODE
Dim oradb As String = "Data Source=" & TNSname & ";User Id=" & User & ";Password= " & password & ";" ' Visual Basic
Dim Inconn As New OracleConnectio n(oradb) ' Visual Basic
Inconn.Connecti onString = oradb
Inconn.Open()
Dim sql As String = "SELECT USERNAME FROM dba_users where default_tablesp ace != 'SYSAUX' and default_tablesp ace != 'SYSTEM' and default_tablesp ace != 'TOOLS' and default_tablesp ace != 'USERS' ORDER BY USERNAME" ' Visual Basic
Dim cmd As New OracleCommand(s ql, Inconn)
cmd.CommandType = CommandType.Tex t
Dim inRS As OracleDataReade r = cmd.ExecuteRead er()
Dim arrTemp() As String = {}
Dim i As Integer = 0
While inRS.Read()
arrTemp(i) = inRS.GetString( 0).ToString
i = i + 1
End While
inRS.Close()
Inconn.Close()
/CODE
Its strange as I can easily populate a text or combo box during the read by just saying
While inRS.Read()
cbo_test.items. add(inRS.Item(" USERNAME"))
End While
I would appreciate anyones thoughts and or direction here as I would rather not go back to ADOBD...
Thanks ahead of time!
Cheers,
Eric
Comment