vb.net - How to save a retrieved column from a datareader into an array? -


I want to retrieve a column of approximately 800 rows in the table and save these values ​​in an array so that reference How can I do this later? I tried:

  con = New OleDb.OleDbConnection ("Provider = SQLOLEDB; Data Source = PC; Initial Catalog = DB1; Integrated Security = SSPI") CMD = New OLEDB Commands (" Select call 1 from Table1 ", con). Open () R = CMD.exe reader while r.read_ob (i) = r.Item (0) (0) i = i + 1 end while Ubound (prev_ob) console for I = 0 .rightline (prev_ob (i) ) Next `  

And it does not work. Col1 is one type of Int64 and similar array is prev_ob (). Please tell me how I can save it in the array.

What's your error? More information will help you get the answer soon.

Try it:

  New list as intent list (int64) CMD = new OLEDB COMMAND ("Choose call 1 from table 1", thief) Con.Open () r = cmd.ExecuteReader while R. Read the int64list.Add (Convert.ToInt64 (r.Item (0)) Finally while in each int xlist for the obj in the Console.WriteLine (obj) obj   

PS I wrote a sample Which works in C # and tries to translate VB.net.

Comments