Query data for specified field names in C DataTable

  • 2021-06-28 13:41:15
  • OfStack

1. After retrieving the corresponding dataset after querying, pass the parameter strcodeName to get the corresponding destination field in the dataset according to the matching corresponding field of strcodeName in the dataset.


private string GetStrName(DataTable dtable, string strcodeName)         {
            string Name = strcodeName;
            DataRow[] dr = dtable.Select(" Match corresponding fields =" + strcodeName);
            if (dr.Length > 0)
            {
                Name = dr[0][" Destination field "].ToString();
            }
            return Name;
        }

2. Default Assignment Match Field, Obtain Destination Field after Query


Related articles: