Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Dynamic arrays

Dynamic arrays

Scheduled Pinned Locked Moved Visual Basic
databasedata-structuresquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    macca24
    wrote on last edited by
    #1

    Anyone have any code that reads a number of records from a database table into a Dynamic Array? macca

    T M 2 Replies Last reply
    0
    • M macca24

      Anyone have any code that reads a number of records from a database table into a Dynamic Array? macca

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      you can do two things : 1st way : use an ArrayList and Add() each element you want... 2nd way : select sum(column) from table... then create a simple array (non redimentionable), which size is the length read previously...


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      M 1 Reply Last reply
      0
      • T toxcct

        you can do two things : 1st way : use an ArrayList and Add() each element you want... 2nd way : select sum(column) from table... then create a simple array (non redimentionable), which size is the length read previously...


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        M Offline
        M Offline
        macca24
        wrote on last edited by
        #3

        Thanks for the reply toxxct, but do you have any example code for this? macca

        1 Reply Last reply
        0
        • M macca24

          Anyone have any code that reads a number of records from a database table into a Dynamic Array? macca

          M Offline
          M Offline
          Mandar Patankar
          wrote on last edited by
          #4

          Dim RecordArray() as string Dim SqlAdap as New sqlAdapter(QueryString,ConnectionString) Dim RowTable as New datatable SqlAdap.fill(RowTable) Dim Myrow as Datarow redim recordArray(rowtable.rows.count-1) as String Dim i as integer=0 'If u need to inser all the fields from the row ' u can create two dimensional array For each myrow in Rowtable.rows recordArray(i) = myRow(0) i+=1 next Mandar Patankar Microsoft Certified professional

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups