I've finally had a chance to take a look at all responses, thanks for
all the help. Upon doing further research I really don't need to use
two dimensional arrays, but instead use a data table or data set(as
noted above). This makes more sense as I can retrieve the column name
and value.

William.

On Feb 20, 9:09 pm, Cesare Imperiali <[email protected]>
wrote:
> the minimal conversion could be:
>
> Public Shared Function PopulateRS(ByVal SQL As String) As DataTable
>
>         Dim dt As New System.Data.DataTable
>         Dim conn As System.Data.OracleClient.OracleConnection = Nothing
>         Dim da3 As System.Data.OracleClient.OracleDataAdapter
>         Dim ls_error_msg As String = Nothing
>         Dim ls_error_msg_redirect As String = Nothing
>
>         BasePage.OpenConnection(conn)
>         da3 = New System.Data.OracleClient.OracleDataAdapter(SQL, conn)
>         da3.Fill(dt)
>
>         BasePage.CloseConnection(conn)
>
>         Return dt
>
>     End Function
>
> you could then play with datable this way:
>
> Dim dt As DataTable = sqlHelper.PopulateRS("select * from testdb")
>         'print all clomns names
>         For Each cl As DataColumn In dt.Columns
>             Response.Write(cl.ColumnName)
>
>         Next
>
>         'print all values of each row
>         For Each dr As DataRow In dt.Rows
>             For Each cl As DataColumn In dt.Columns
>                 Response.Write(dr(cl).ToString())
>             Next
>         Next
>
> 2010/2/18 Will <[email protected]>:
>
>
>
> > I haven't really had a chance to look over everyones responses as I
> > was away for almost a week. I appreciate everyones help and once I get
> > back into the working groove, I will take a closer look all responses.
>
> > Thanks again.
>
> > On Feb 13, 4:12 pm, Eder Sousa <[email protected]> wrote:
> >> To create a 2 dimensional array:
> >> Exemplo:
> >> Dim Array(X, Y) as String
> >> 'X - Lines
> >> 'Y- Rows
>
> >> On Sat, Feb 13, 2010 at 5:10 PM, Charles A. Lopez
> >> <[email protected]>wrote:
>
> >> > Interesting. What exactly are you trying to do?
>
> >> > You state you want to create a 2 dimensional array. Then what?
>
> >> > On 12 February 2010 09:44, Will <[email protected]> wrote:
>
> >> >> As I am new to programming in VB.Net, I would like to know how to
> >> >> create a 2 dimensional array.
>
> >> >> I need to make a select call to the DB and bring back the values,
> >> >> store the column name with the data associated with it.
>
> >> >> For example,
>
> >> >> Colums and data for table users_table
>
> >> >>           user_id      last_access_dt       upd_by         upd_dt
> >> >> Row 1: TESTER   12-February 2010    WILLV         12-February 2010
> >> >> Row 2: DASANI    12-February 2010    WILLV         12-February 2010
> >> >> etc. etc.
>
> >> >> //Select statement
> >> >> SELECT * FROM users_table
>
> >> >> I do understand the code below populates a one dimensional array. I
> >> >> just can't seem to find anything that I can wrap my brain around. One
> >> >> of those days.
>
> >> >> //The declaration below is from a function that calls PopulateRS
> >> >> Function ProcessSuccessfulConnection
> >> >> Dim arrReturn() As String
>
> >> >> ls_sql_String = " SELECT * FROM users_table"
> >> >> arrReturn = SQLHelper.PopulateRS(ls_sql_String)
> >> >> array_count = arrReturn.Length
>
> >> >>     If array_count > 0 Then
>
> >> >>        For cc = 0 To array_count - 1
> >> >>          ls_data= arrReturn(cc)
>
> >> >>          **Here I would like to search for specific column names and
> >> >> its values.**
> >> >>          **Based on the column names and its values, I have to
> >> >> manipulate some more code.**
>
> >> >>       Next
>
> >> >>     End If
>
> >> >> End Function
>
> >> >> //In SQLHelper
> >> >> Public Shared Function PopulateRS(ByVal SQL As String) As String()
>
> >> >> Dim rsArray(0 To -1) As String
> >> >> Dim i As Integer = 0
> >> >> Dim ds3 As System.Data.DataSet = New System.Data.DataSet
> >> >> Dim conn As System.Data.OracleClient.OracleConnection = Nothing
> >> >> Dim da3 As System.Data.OracleClient.OracleDataAdapter
> >> >> Dim ls_error_msg As String = Nothing
> >> >> Dim ls_error_msg_redirect As String = Nothing
>
> >> >> BasePage.OpenConnection(conn)
> >> >> da3 = New System.Data.OracleClient.OracleDataAdapter(SQL, conn)
> >> >> da3.Fill(ds3)
>
> >> >> If ds3.Tables(0).Rows.Count > 0 Then
> >> >>   'ReDim Preserve rsArray(ds3.Tables(0).Rows.Count)
> >> >>   ReDim Preserve rsArray(ds3.Tables(0).Rows.Count -1)
> >> >>        For Each dr As System.Data.DataRow In ds3.Tables(0).Rows
> >> >>           rsArray(i) = CStr(dr(0).ToString)
> >> >>           'Check if it is the last row
> >> >>           If i < ds3.Tables(0).Rows.Count Then
> >> >>             i = i + 1
> >> >>           Else
> >> >>              Exit For
> >> >>           End If
> >> >>        Next
> >> >> End If
>
> >> >>  BasePage.CloseConnection(conn)
>
> >> >>  PopulateRS = rsArray
>
> >> >> End Function
>
> >> >> Any help would be much appreciated.
>
> >> >> Thanks,
>
> >> >> William
>
> >> > --
> >> > Charles A. Lopez
> >> > [email protected]
>
> >> > Registered Microsoft Partner
>
> >> > New York City, NY
>
> >> > I'm running on Windows 7 Build 7100
>
> >> > Quality Software Works
>
> >> --
> >> Eder Sousa
> >> Technology Information
> >> [email protected]
> >> [email protected]
> >> [email protected] Hide quoted text -
>
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to