hi,

I am a student who is doing a project on querying in my sch fyp project and i have encountered a major problem in my project that i need to solve quickly.

I am using visual studio.net 2003 and sqlserver 2000. I am researching on small group sampling which require me to download the tpc.h
benchmark that consist of several tables and one of them is a table that consist of 6 million records called "LINEITEM".

the algo require me to query this table and count the column, "LineNumber", "Quantity" and "ExtendedPrice" and sort them by the distinct values in descending count order.

I executed the query :

SELECT L_ExtendedPrice, COUNT (*) AS Count FROM LINEITEM GROUP BY L_ExtendedPrice ORDER BY Count DESC)

in a sqlserver query analyzer and got 7, 50 and 90283 distinct values for the respective columns "LineNumber", "Quantity" and "ExtendedPrice".

I wrote the same codes for all 3 in visual c#.net and was able to get what I want for "LineNumber" and "Quantity" but there is an error for the "ExtendedPrice" column.
__________________________________________________ __________
these are the codes that i have :

string selectExtendedPriceOccurrences = "SELECT L_ExtendedPrice, COUNT (*) AS Count FROM LINEITEM GROUP BY L_ExtendedPrice ORDER BY Count DESC";

conn = new SqlConnection(source);
conn.Open();
SqlCommand cmdExtendedPrice = new SqlCommand selectExtendedPriceOccurrences, conn);
SqlDataReader reader = cmdExtendedPrice.ExecuteReader(); <--ERROR

MessageBox.Show("Displaying ExtendedPrice Occurrences");
while (reader.Read())
{
//Display Values
MessageBox.Show(reader[1].ToString(), "Occurrences of " + reader[0].ToString());
}
conn.Close();
conn.Open();
SqlDataAdapter daExtendedPriceOccurrences = new SqlDataAdapter (selectExtendedPriceOccurrences, conn);

daExtendedPriceOccurrences.Fill(dsExtendedPriceOcc urrences, "ExtendedPriceOccurrences");
conn.Close(); <-- ERROR

__________________________________________________ __________

I have error at the following code :

SqlDataReader reader = cmdExtendedPrice.ExecuteReader();

I though it might be a problem with the DataReader part that cannot take in so much values (90283 distinct values) and so i deleted away the DataReader part but i got another error at:

daExtendedPriceOccurrences.Fill(dsExtendedPriceOcc urrences, "ExtendedPriceOccurrences");
conn.Close();

both of the above show the ERROR msg is :

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error.


can anyone please help. I am really in need of any advices provided.
thanks in advance.
waiting anxiously.