Unanswered: urgent: visual studio.net & sql server
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);
SqlCommand cmdExtendedPrice = new SqlCommand selectExtendedPriceOccurrences, conn);
SqlDataReader reader = cmdExtendedPrice.ExecuteReader(); <--ERROR
MessageBox.Show("Displaying ExtendedPrice Occurrences");
MessageBox.Show(reader.ToString(), "Occurrences of " + reader.ToString());
SqlDataAdapter daExtendedPriceOccurrences = new SqlDataAdapter (selectExtendedPriceOccurrences, conn);