FilterSting in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baburk
    New Member
    • Oct 2006
    • 111

    FilterSting in C#

    I am using filterstring like this in C#

    filterMaterialN ame = "VendorID = '" + vendorId + "' ";
    DataRow[] drMaterialName = dsMaterials.Tab les[3].Select(filterM aterialName);

    But I want to use set operation "IN" where those values are in another table dsMaterials.Tab les[2]

    I need help
  • baburk
    New Member
    • Oct 2006
    • 111

    #2
    Using set operation in filterstring

    //set all the SET values to a sting
    string dc = null;
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
    string s = ds.Tables[0].Rows[i]["CountryId"].ToString() + ",";
    dc = dc + s;
    }
    dc = dc.Substring(0, dc.Length - 1);

    filter = "CountryId in (" + dc + ") ";
    DataRow[] dr = ds.Tables[1].Select(filter) ;

    Comment

    • baburk
      New Member
      • Oct 2006
      • 111

      #3
      In datarow Iam getting all the columns.

      DataRow[] dr = ds.Tables[1].Select(filter) ;

      But I want to get only a partiular column values.

      How Can I.

      I want to assing to a variable without looping like this
      Is there is any way.

      string dc = null;
      for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
      {
      string s = ds.Tables[0].Rows[i]["CountryId"].ToString() + ",";
      dc = dc + s;
      }

      Comment

      Working...