473,395 Members | 2,253 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,395 software developers and data experts.

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
Nov 9 '07 #1
3 1256
"Guilherme Grillo" <we****@rncomtotal.com.brwrote in message
news:us**************@TK2MSFTNGP05.phx.gbl...
How can I populate an Array with the information of an Table in SQL?
http://www.google.co.uk/search?hl=en...rraylist&meta=
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 9 '07 #2
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]" <ma**@markNOSPAMrae.netwrote in message
news:Og**************@TK2MSFTNGP04.phx.gbl...
"Guilherme Grillo" <we****@rncomtotal.com.brwrote in message
news:us**************@TK2MSFTNGP05.phx.gbl...
>How can I populate an Array with the information of an Table in SQL?

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

Nov 9 '07 #3
Problem Solved!

Thanks everybody....
Grillo

ps: sorry my english..
"Guilherme Grillo" <we****@rncomtotal.com.brwrote in message
news:uJ**************@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.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]" <ma**@markNOSPAMrae.netwrote in message
news:Og**************@TK2MSFTNGP04.phx.gbl...
>"Guilherme Grillo" <we****@rncomtotal.com.brwrote in message
news:us**************@TK2MSFTNGP05.phx.gbl...
>>How can I populate an Array with the information of an Table in SQL?

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


Nov 9 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Angela Byars | last post by:
I imported several .dbf's from another application to use as the basis for my form. In addition to displaying the records that were created with the original application my users will be adding...
4
by: Jens Mittag | last post by:
Hi! In my code, I have an array of a structure, which I want to save to a binary file. When the array is just created, everything works fine, but when I change contents of the array, saving...
3
by: Karunakararao | last post by:
Hi All i have 40,000 records. populate the total records in Datagrid . it's taken time I need to populate the first 2000 records After the need to populate next 2000 records. how can i do...
2
by: George | last post by:
Is there a fast way to transfer an Excel range to an array? Example: Excel range is E2:E300 Dim person() as string Thanks, George
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
2
by: Dave McKie | last post by:
Hi all I am trying to Populate a combo box from a selection in an adjacent Listview. The Listview lists as a string the field names of 4 different fields in tblFile. So far I can populate the...
5
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
3
by: OliveOyl3471 | last post by:
In Visual Basic.NET 2003, how do you populate a two dimensional array from a text file? I know how to check file existence, open the file for read, etc. I just can't get it to read more than one...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.