sunspotzzz

sunspotzzz

  • NA
  • 31
  • 0

visual c#.net & sql server 2000

Feb 12 2004 9:01 AM
hi, I am a student who is doing a project on small group sampling 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(); SqlDataAdapter daExtendedPriceOccurrences = new SqlDataAdapter (selectExtendedPriceOccurrences, conn); daExtendedPriceOccurrences.Fill(dsExtendedPriceOccurrences, "ExtendedPriceOccurrences"); conn.Close(); <-- ERROR ______________________________________________________________________________________________________ I have error at the following code : daExtendedPriceOccurrences.Fill(dsExtendedPriceOccurrences, "ExtendedPriceOccurrences"); conn.Close(); 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.

Answers (4)