473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

insert values to array

i want to insert selected values from SQL to two dimensional array
Jun 14 '07 #1
1 1228
dip_developer
648 Expert 512MB
i want to insert selected values from SQL to two dimensional array
Similar to declaring variables, an array is declared with a Dim statement. The array name is followed by a pair of parentheses to indicate an array variable. For a single dimension array (one column) the parentheses are empty; for a multidimensional array commas are used for each additional column. An array is typed in the same way as variables to declare the type of data to occupy the array. The following statements declare a single- and a two-dimensional array, respectively, each of which contain string data.

Dim Letters() As String
Dim Letters(,) As String

When arrays are declared, they do not have physical sizes. They have dimensions, but the number of rows and columns is unknown. If you know in advance the number of values that will occupy an array, you can include the size as part of its declaration. The two previous Letters arrays can be declared as

Dim Letters(4) As String
Dim Letters(4,1) As String

to indicate an array with 5 rows, and an array with 5 rows and 2 columns, respectively. Note that, because array indexing begins with 0, the dimensions of an array are always 1 less than the actual number of array elements. You can determine the actual size of an array through the arrayName.Length property, which returns the total number of elements in the array.

if You have a Dataset or Datareader returned by your query then by a simple loop you can populate your array......

I dont know about your data and array structure...So here is a snippet of code which can be useful.......

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim myArray(m,n) as String 
  3. For i as Integer=0 To m
  4. For j as Integer=0 To n
  5.      myArray(m,n)=mydataset.Table(0).Row(m).Item(n)
  6. Next
  7. Next
  8.  
Jun 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
11
by: Chris Fink | last post by:
I have setup an Oracle table which contains a blob field. How do I insert data into this field using C# and ADO.net?
2
by: blitzztriger | last post by:
Hello!! how do i insert values into mysql , after parsing a submiting textbox?? I made the arrays, so this should be a basic insertion of them in the db, but something is missing, or in the wrong...
15
by: Maarten | last post by:
I've found some answers to my problem on this forum, but not exactly the answer I was looking for. Sorry if I've missed something. This is my situation: I am trying to make an insertion into an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.