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.br> wrote in message
news:usThK6uIIHA.1212@.TK2MSFTNGP05.phx.gbl...

> How can I populate an Array with the information of an Table in SQL?
http://www.google.co.uk/search?hl=e...br />
st&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.CloseConnection);
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.net> wrote in message
news:OgWpENvIIHA.4296@.TK2MSFTNGP04.phx.gbl...
> "Guilherme Grillo" <webdev@.rncomtotal.com.br> wrote in message
> news:usThK6uIIHA.1212@.TK2MSFTNGP05.phx.gbl...
>
> http://www.google.co.uk/search?hl=e... />
list&meta=
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
Problem Solved!
Thanks everybody...
Grillo
ps: sorry my english..
"Guilherme Grillo" <webdev@.rncomtotal.com.br> wrote in message
news:uJeouewIIHA.4712@.TK2MSFTNGP04.phx.gbl...
> 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.CloseConnection);
> 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.net> wrote in message
> news:OgWpENvIIHA.4296@.TK2MSFTNGP04.phx.gbl...
>

0 comments:

Post a Comment