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
