Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OracleDataReader vb.net

571669Oct 5 2009 — edited Nov 4 2009
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 OracleDataReader 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 OracleConnection(oradb) ' Visual Basic
Inconn.ConnectionString = oradb
Inconn.Open()

Dim sql As String = "SELECT USERNAME FROM dba_users where default_tablespace != 'SYSAUX' and default_tablespace != 'SYSTEM' and default_tablespace != 'TOOLS' and default_tablespace != 'USERS' ORDER BY USERNAME" ' Visual Basic

Dim cmd As New OracleCommand(sql, Inconn)
cmd.CommandType = CommandType.Text

Dim inRS As OracleDataReader = cmd.ExecuteReader()

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 2 2009
Added on Oct 5 2009
3 comments
2,972 views