Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
CitrusBoy
Starting Member
2 Posts |
Posted - 2005-07-07 : 02:51:37
|
Hey, I hope someone can help me!!I'm developing a web application using VB.NET, querying data from a SQL server database, the thing is that the datafields being queried need to be grouped to stop multiple entries of the same product being returned to the bound object.What happens is the data needed is queried from the database returning the needed data and loading it into the dataset. I cant group the data from the source field in the database, as the data contained in the dataset and database arent the same any more, so no go! Maybe I just need someone to help me think outa the box! Thats usually the case... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-07 : 03:07:51
|
quote: I cant group the data from the source field in the database, as the data contained in the dataset and database arent the same any more, so no go!
Why?Can you give more information on where you are struggling?Give table structure, sample data and expected resultMadhivananFailing to plan is Planning to fail |
 |
|
|
CitrusBoy
Starting Member
2 Posts |
Posted - 2005-07-07 : 03:39:24
|
| OK, the table has fields containing data on printer cartridges, and as expected some printers have more than one cartridge available for the one model... The specific queries I'm having troubles with are the ones where the user has already selected a printer manufacturer, e.g. "Lexmark", as well as a type of printer e.g. "Inkjet". On selecting "Inkjet" the application then runs a query to list all the Printer Models to a dropdownlist. Now the query then returns all the printers where the field 'type' matches "Inkjet"! Problem is that the the same models are repeated as many times as there are entries in the table, naturally!! The thing is using a 'GROUP BY [Lexmark].[Printer]' in the SQL query string returns the following error: "Column 'Lexmark.Type' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."You cant Group By that field in the Table, because there are other printer types like Laserjets,etc. also present, so it cant find some of the records in the dataset, since it only contains the records where the Printer 'Type' = "Inkjet". So if there's a way to Group by a field within the dataset, that'd be great!!Else the only other thing woould be to redesign my database to separate all the different types of printer! And, I'm really not too amped to do that.... All want is to group the double fields loaded into the dataset.... |
 |
|
|
|
|
|
|
|