国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

如何搜索DataTable中的值

2024-07-21 02:22:33
字體:
來源:轉載
供稿:網(wǎng)友
中國最大的web開發(fā)資源網(wǎng)站及技術社區(qū),
gets a specified datarow.

overload list
gets the row specified by the primary key value.

[visual basic] overloads public function find(object) as datarow
[c#] public datarow find(object);
[c++] public: datarow* find(object*);
[jscript] public function find(object) : datarow;
gets the row containing the specified primary key values.

[visual basic] overloads public function find(object()) as datarow
[c#] public datarow find(object[]);
[c++] public: datarow* find(object*[]);
[jscript] public function find(object[]) : datarow;
example
[visual basic, c#] the following example uses the values of an array to find a specific row in a collection of datarow objects. the method presumes a datatable exists with three primary key columns. after creating an array of the values, the code uses the find method with the array to get the particular object desired.

[visual basic, c#] note   this example shows how to use one of the overloaded versions of find. for other examples that might be available, see the individual overload topics.
[visual basic]
private sub findinmultipkey(byval mytable as datatable)
   dim foundrow as datarow
   ' create an array for the key values to find.
   dim findthesevals(2) as object
   ' set the values of the keys to find.
   findthesevals(0) = "john"
   findthesevals(1) = "smith"
   findthesevals(2) = "5 main st."
   foundrow = mytable.rows.find(findthesevals)
   ' display column 1 of the found row.
   if not (foundrow is nothing) then
     console.writeline(foundrow(1).tostring())
   end if
end sub
[c#]
private void findinmultipkey(datatable mytable){
    datarow foundrow;
    // create an array for the key values to find.
    object[]findthesevals = new object[3];
    // set the values of the keys to find.
    findthesevals[0] = "john";
    findthesevals[1] = "smith";
    findthesevals[2] = "5 main st.";
    foundrow = mytable.rows.find(findthesevals);
    // display column 1 of the found row.
    if(foundrow != null)
      console.writeline(foundrow[1]);
}
[c++, jscript] no example is available for c++ or jscript. to view a visual basic or c# example, click the language filter button  in the upper-left corner of the page.

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 都江堰市| 绥德县| 天镇县| 搜索| 北安市| 平昌县| 和顺县| 安乡县| 望奎县| 安多县| 布尔津县| 楚雄市| 古浪县| 贡山| 渭源县| 商城县| 湛江市| 沭阳县| 阿城市| 休宁县| 贡山| 勐海县| 新干县| 晋城| 上饶市| 梅河口市| 阿克陶县| 孟连| 安徽省| 安康市| 铜山县| 共和县| 南平市| 内江市| 博乐市| 廊坊市| 三亚市| 壤塘县| 勃利县| 海城市| 云阳县|