Maarten

Maarten

  • NA
  • 1
  • 0

Getting database records into an array

Mar 3 2009 9:52 AM
Hi there,

I'm new here, so this is my first post ;)

I've got a problem to get my database content into an array, in fact I don't have a clue how to do it :-s. It's the
plan to process all the records and to put the content of those recors in the array. Can someone tell me how to do it? Thanks in advance!

This is the code that I have, for the moment I have hardcoded the array, but it's the purpose to fill the array with the database content.


string MainSQL =
"select id, firstname, surname, gender, email, telephone, city +
"from persoon";

string[,] persons= new string[2, 7];

persons[0, 0] = "1";  (id)
persons[0, 1] = "Jef"; (firstname)
persons[0, 2] = "Maes"; (surname)
persons[0, 3] = "male"; (gender)
persons[0, 4] = "[email protected]"; (email)
persons[0, 5] = "123/456789"; (telephone)
persons[0, 6] = "Testegem"; (city)

persons[1, 0] = "2";
persons[1, 1] = "Koen";
persons[1, 2] = "Mertens";
persons[1, 3] = "male";
personen[1, 4] = "[email protected]";
persons[1, 5] = "123/456789";
persons[1, 6] = "Testegem";


P.S. Excuse me for my bad english.

Answers (1)