HI, I'm using Using LLBLGenPro 2.0.0.0 (feb 14th), adapter scenario, .net 2.0, and sql server 2000.
I have a view named "MetroZip" that joins 3 tables
SELECT dbo.metro_header.metro_class, dbo.metro_header.metro_description, dbo.metro.metro_type_cd,
dbo.metro.metro_state_province, dbo.metro.metro_county, dbo.zip.ZIPCode, dbo.zip.City, dbo.zip.County,
dbo.zip.StateCode
FROM dbo.metro INNER JOIN
dbo.zip ON dbo.metro.metro_state_province = dbo.zip.StateCode AND
dbo.metro.metro_county = dbo.zip.County INNER JOIN
dbo.metro_header ON dbo.metro.metro_type_cd = dbo.metro_header.metro_type_cd
I now want to use the generated code to run a query against the mapped typed view MetroZipTypedView. Here's ultimately the SQL I want to execute:
SELECT DISTINCT metro_class, metro_description, metro_type_cd, city FROM ujenziMetroZip where metro_state_province = 'NJ' ORDER BY metro_class ASC
Here's a C# method that I think should do it
public static MetroZipTypedView GetMetrosForState(string stateCd, string connectionString)
{
MetroZipTypedView metroZipTypedView = new MetroZipTypedView();
RelationPredicateBucket bucket =
new RelationPredicateBucket(MetroZipFields.StateCode == stateCd);
DataAccessAdapter daa = new DataAccessAdapter(connectionString);
ResultsetFields fields = new ResultsetFields(4);
fields.DefineField(MetroZipFields.MetroClass, 0);
fields.DefineField(MetroZipFields.MetroDescription, 1);
fields.DefineField(MetroZipFields.MetroTypeCd, 2);
fields.DefineField(MetroZipFields.City, 3);
ISortExpression sortExpression = new SortExpression(MetroZipFields.MetroClass | SortOperator.Ascending);
daa.FetchTypedView(fields, metroZipTypedView, bucket, 0, sortExpression, false);
return metroZipTypedView;
}
When I run this method the TypedView has the City field populated with the 4th field in the view (metro_state_province) and NOT the City. I've attached a screen shot of the debug visualizer containing the contents of metroZipTypedView.
Is this a bug or am I doing something wrong?
Attachments
Filename |
File size |
Added on |
Approval |
visualizer.jpg
|
29,792 |
06-Mar-2007 23:14.06 |
Approved |