Monday, March 26, 2012

Populate an Array with DB records

Hi Friends,

How can I populate an Array with the information of an Table in SQL?

Thanks... and sorry my english...

Grillo"Guilherme Grillo" <webdev@.rncomtotal.com.brwrote in message
news:usThK6uIIHA.1212@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

How can I populate an Array with the information of an Table in SQL?


http://www.google.co.uk/search?hl=e...Arraylist&meta=
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Thank you Mark Rae...

Solve my problem!

Now I have another problem.

try

{

int[] pointList = new Int32[60];

int[] idList = new Int32[60];

int i;

for (i = 1; i <= 57; i++)

{

// Cria o comando que seleciona os resultados atuais

commSELECT = new SqlCommand("SELECT * FROM contResults WHERE id = " + i +
"", conn);

// Executa o comando e coloca os resultados em uma Matriz

conn.Open();

readerSELECT = commSELECT.ExecuteReader(CommandBehavior.CloseConn ection);

readerSELECT.Read();

pointList[i] = readerSELECT["contResults"];

idList[i] = readerSELECT["id"];

readerSELECT.Close();

Error 1 Cannot implicitly convert type 'object' to 'int'. An explicit
conversion exists (are you missing a cast?)

How can I convert this type??

Here I have the same error:

*int[] respostasList = new Int32[20];

respostasList[1] = RadioButtonList1.SelectedItem.Value;

Sorry my english and thanks again.

Grillo

"Mark Rae [MVP]" <mark@.markNOSPAMrae.netwrote in message
news:OgWpENvIIHA.4296@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

"Guilherme Grillo" <webdev@.rncomtotal.com.brwrote in message
news:usThK6uIIHA.1212@.TK2MSFTNGP05.phx.gbl...
>

Quote:

Originally Posted by

>How can I populate an Array with the information of an Table in SQL?


>
http://www.google.co.uk/search?hl=e...Arraylist&meta=
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Problem Solved!

Thanks everybody...
Grillo

ps: sorry my english..

"Guilherme Grillo" <webdev@.rncomtotal.com.brwrote in message
news:uJeouewIIHA.4712@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Thank you Mark Rae...
>
Solve my problem!
>
Now I have another problem.
>
>
try
>
{
>
int[] pointList = new Int32[60];
>
int[] idList = new Int32[60];
>
int i;
>
for (i = 1; i <= 57; i++)
>
{
>
// Cria o comando que seleciona os resultados atuais
>
commSELECT = new SqlCommand("SELECT * FROM contResults WHERE id = " + i +
"", conn);
>
// Executa o comando e coloca os resultados em uma Matriz
>
conn.Open();
>
readerSELECT = commSELECT.ExecuteReader(CommandBehavior.CloseConn ection);
>
readerSELECT.Read();
>
pointList[i] = readerSELECT["contResults"];
>
idList[i] = readerSELECT["id"];
>
readerSELECT.Close();
>
>
Error 1 Cannot implicitly convert type 'object' to 'int'. An explicit
conversion exists (are you missing a cast?)
>
How can I convert this type??
>
Here I have the same error:
>
*int[] respostasList = new Int32[20];
>
respostasList[1] = RadioButtonList1.SelectedItem.Value;
>
>
Sorry my english and thanks again.
>
Grillo
>
"Mark Rae [MVP]" <mark@.markNOSPAMrae.netwrote in message
news:OgWpENvIIHA.4296@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

>"Guilherme Grillo" <webdev@.rncomtotal.com.brwrote in message
>news:usThK6uIIHA.1212@.TK2MSFTNGP05.phx.gbl...
>>

Quote:

Originally Posted by

>>How can I populate an Array with the information of an Table in SQL?


>>
>http://www.google.co.uk/search?hl=e...Arraylist&meta=
>>
>>
>--
>Mark Rae
>ASP.NET MVP
>http://www.markrae.net


>
>

0 comments:

Post a Comment