2011-08-09 14 views
0

こんにちは私はDataSetを持っていて、それはヘッダーと呼ばれるテーブルを持っています。ヘッダーテーブルには、Long Agency Codeというフィールドがあります。 Wageと呼ばれるテーブルにはLong Agency Codeというフィールドもあります。ヘッダーテーブルで使用可能なロング代行コードに基づいてウェイジテーブルをフィルタリングします。次のコードは、以下を示しています。DataRowフィルター式

DataTable dt = DataSet.Tables["Header"]; 

        DataRowCollection headerRowCollection = dt.Rows; 

        foreach (DataRow headerRow in headerRowCollection) 
        { 
         FixedOutputter outputter = GetOutputter("Header", streamWriter); 
         MapElementCollection mapElementCollection = MapUtility.GetMapElementCollection(DataMap, "Header", DataMapFormatters); 
         outputter.OutputSingleRow(headerRow, mapElementCollection); 
         string filterExpression = "Long Agency Code == '" + headerRow["Long Agency Code"] + "'"; 
         DataRow[] wageRowCollection = DataSet.Tables["Wage"].Select(filterExpression); 

それはメッセージと非常に最後の行で吹く:「構文エラー: 『庁』演算子の後にオペランドがありません」

答えて

3

==ではなく、=の1つを使用してください(角括弧内のLong Agency Code)。ここで

はまともなリファレンスです:Long Agency Code == '(something)'を考え出すとき、あなたはhttp://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

何のソースを使用しましたか? (間違っている!)

+0

ありがとう、それはトリックでした! – SaiBand