array data storage problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bharathi228
    New Member
    • Jul 2008
    • 28

    array data storage problem

    dim arr as array=array.cre ateinstance(get ype(channel),pa ram_index)

    ARR(PARAM_INDEX )=NEW CHANNEL

    HERE CHANNEL IS CLASSNAME

    PARAM_INDEX IS COMING FROM DATABASE

    problem occur in this situtation
    redim presereve arr(param_index )

    HOW TO DO THIS.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    There's a few problems with this post. Please elaborate more on your question. It is very hard to understand. Please clearly state what you are trying to achieve and what problems you are having achieving it, not just asking how to do it.

    You also need a more descriptive title. Titles are important, because they let the experts know what your thread is about. They may skip it if it isn't descriptive, and you won't get any help.

    Third, please don't type in all-caps. On the internet that is the same as shouting and considered very rude.

    Lastly, when posting code, it needs to be surrounded by [CODE] tags. You can use the # button on the text editor.

    Please re-work your question properly and post it as a reply to this thread.

    MODERATOR

    Comment

    • bharathi228
      New Member
      • Jul 2008
      • 28

      #3
      array data storage problem

      Hi,

      this is my code.
      Code:
      strQUERY = "SELECT PARAMETER_INDEX,SITE FROM SYS_PARAMS ORDER BY PARAMETER_INDEX"
              If CON.State = ConnectionState.Closed Then
                  CON.Open()
              End If
              da = New SqlDataAdapter(strQUERY, CON)
              Dim ds1 As New DataSet
              da.Fill(ds1)
              reccount = ds1.Tables(0).Rows.Count
              mvarTOTAL_PARAMETERS = reccount
      Dim x As Integer
              For x = 0 To mvarTOTAL_PARAMETERS
                  ReDim Preserve muiparamCHANNEL_ARRAY(x)
                  muiparamCHANNEL_ARRAY(x) = New CHANNEL------(class)
      
      
      
      -------à    (the above step is go to the channel class ,default values retrived)
      
              Next x
      
              For Each r In ds1.Tables(0).Rows
                  intPARAM_INDEX = r.Item("PARAMETER_INDEX")
                  If intPARAM_INDEX <= mvarTOTAL_PARAMETERS Then
      muiparamCHANNEL_ARRAY(intPARAM_INDEX).PARAMETER_INDEX = r.Item("PARAMETER_INDEX")
                      muiparamCHANNEL_ARRAY(intPARAM_INDEX).SITE = r.Item("site")
      
                      muiparamCHANNEL_ARRAY(intPARAM_INDEX).IO_OBJECT = mvarINPUT_OUTPUT
                      muiparamCHANNEL_ARRAY(intPARAM_INDEX).DB_RETRIEVE()
      
      
      ----à   the above step is go to channel class and execute DB_RETRIEVE() store the values muiparamCHANNEL_ARRAY ,but each time replaced all the dimensions replaced
      
      
                  End If
      Next
      “After complte for loop muiparamCHANNEL _ARRAY is last retrived values all rows same displayed whats the problem ,can u suggestion for sol”



      --------------Old vb code----------------------

      Code:
      strQUERY = "SELECT PARAMETER_INDEX, PARAMETER_NAME, " & _
                     "PARAMETER_UNITS, SITE FROM " & _
                     "SYS_PARAMS ORDER BY PARAMETER_INDEX"
          Set recSYS_CONFIG = dbSYS_CONFIG.OpenRecordset(strQUERY)
          If recSYS_CONFIG.RecordCount > 0 Then
            recSYS_CONFIG.MoveLast
            recSYS_CONFIG.MoveFirst
            Do While Not recSYS_CONFIG.EOF
              intINDEX = recSYS_CONFIG!PARAMETER_INDEX
              If intINDEX <= mvarTOTAL_PARAMETERS Then
                muiparamCHANNEL_ARRAY(intINDEX).SYSTEM_DB_NAME = _
                  mvarSYSTEM1_DB_NAME
                muiparamCHANNEL_ARRAY(intINDEX).PARAMETER_NAME = _
                  recSYS_CONFIG!PARAMETER_NAME
                muiparamCHANNEL_ARRAY(intINDEX).PARAMETER_UNITS = _
                  recSYS_CONFIG!PARAMETER_UNITS
                muiparamCHANNEL_ARRAY(intINDEX).SITE = recSYS_CONFIG!SITE
                Set muiparamCHANNEL_ARRAY(intINDEX).IO_OBJECT = mvarINPUT_OUTPUT
                muiparamCHANNEL_ARRAY(intINDEX).DB_RETRIEVE
              End If
              recSYS_CONFIG.MoveNext
            Loop
          End If
      Last edited by Curtis Rutland; Aug 30 '08, 06:46 AM. Reason: Added code tags -- Please use the # button

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        Please read and follow moderator's instructions more carefully. I asked you to use code tags and to post your updated question as a reply to this thread, not to make a new one.

        I have merged the threads and added code tags for you, but please read our Posting Guidelines carefully before you post again, and follow all our forum's rules.

        MODERATOR

        Comment

        Working...