• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專(zhuān)題視頻專(zhuān)題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專(zhuān)題1關(guān)鍵字專(zhuān)題50關(guān)鍵字專(zhuān)題500關(guān)鍵字專(zhuān)題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專(zhuān)題關(guān)鍵字專(zhuān)題tag2tag3文章專(zhuān)題文章專(zhuān)題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專(zhuān)題3
    問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
    當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

    DataView.RowFilter的使用(包括in,like等SQL中的操作符)

    來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 22:42:51
    文檔

    DataView.RowFilter的使用(包括in,like等SQL中的操作符)

    DataView.RowFilter的使用(包括in,like等SQL中的操作符):DataView RowFilter Syntax [C#] This example describes syntax of DataView.RowFil ter expression. It shows how to correctly build expression string (without „SQL injection) using methods to escape values. Column names If a column name
    推薦度:
    導(dǎo)讀DataView.RowFilter的使用(包括in,like等SQL中的操作符):DataView RowFilter Syntax [C#] This example describes syntax of DataView.RowFil ter expression. It shows how to correctly build expression string (without „SQL injection) using methods to escape values. Column names If a column name

    DataView RowFilter Syntax [C#]
    This example describes syntax of DataView.RowFil ter expression. It shows how to correctly build expression string (without „SQL injection“) using methods to escape values.

    Column names
    If a column name contains any of these special characters ~ ( ) # / / = > < + - * % & | ^ ' " [ ], you must enclose the column name within square brackets [ ]. If a column name contains right bracket ] or backslash /, escape it with backslash (/] or //).

    [C#]

    dataView.RowFilter = "id = 10"; // no special character in column name "id" dataView.RowFilter = "$id = 10"; // no special character in column name "$id" dataView.RowFilter = "[#id] = 10"; // special character "#" in column name "#id" dataView.RowFilter = "[[id/]] = 10"; // special characters in column name "[id]"
    Literals
    String values are enclosed within single quotes ' '. If the string contains single quote ', the quote must be doubled.

    [C#]

    dataView.RowFilter = "Name = 'John'" // string value dataView.RowFilter = "Name = 'John ''A'''" // string with single quotes "John 'A'" dataView.RowFilter = String.Format("Name = '{0}'", "John 'A'".Replace("'", "''"));
    Number values are not enclosed within any characters. The values should be the same as is the result of int.ToString() or float.ToString() method for invariant or English culture.

    [C#]

    dataView.RowFilter = "Year = 2008" // integer value dataView.RowFilter = "Price = 1199.9" // float value dataView.RowFilter = String.Format(CultureInfo.InvariantCulture.NumberFormat, "Price = {0}", 1199.9f);
    Date values are enclosed within sharp characters # #. The date format is the same as is the result of DateTime.ToString() method for invariant or English culture.

    [C#]

    dataView.RowFilter = "Date = #12/31/2008#" // date value (time is 00:00:00) dataView.RowFilter = "Date = #2008-12-31#" // also this format is supported dataView.RowFilter = "Date = #12/31/2008 16:44:58#" // date and time value dataView.RowFilter = String.Format(CultureInfo.InvariantCulture.DateTimeFormat, "Date = #{0}#", new DateTime(2008, 12, 31, 16, 44, 58));
    Alternatively you can enclose all values within single quotes ' '. It means you can use string values for numbers or date time values. In this case the current culture is used to convert the string to the specific value.

    [C#]

    dataView.RowFilter = "Date = '12/31/2008 16:44:58'" // if current culture is English dataView.RowFilter = "Date = '31.12.2008 16:44:58'" // if current culture is German dataView.RowFilter = "Price = '1199.90'" // if current culture is English dataView.RowFilter = "Price = '1199,90'" // if current culture is German
    Comparison operators
    Equal, not equal, less, greater operators are used to include only values that suit to a comparison expression. You can use these operators = <> < <= > >=.

    Note: String comparison is culture-sensitive, it uses CultureInfo from DataTable.Locale property of related table (dataView.Table.Locale). If the property is not explicitly set, its default value is DataSet.Locale (and its default value is current system culture Thread.Curren tThread.Curren tCulture).

    [C#]

    dataView.RowFilter = "Num = 10" // number is equal to 10 dataView.RowFilter = "Date < #1/1/2008#" // date is less than 1/1/2008 dataView.RowFilter = "Name <> 'John'" // string is not equal to 'John' dataView.RowFilter = "Name >= 'Jo'" // string comparison
    Operator IN is used to include only values from the list. You can use the operator for all data types, such as numbers or strings.

    [C#]

    dataView.RowFilter = "Id IN (1, 2, 3)" // integer values dataView.RowFilter = "Price IN (1.0, 9.9, 11.5)" // float values dataView.RowFilter = "Name IN ('John', 'Jim', 'Tom')" // string values dataView.RowFilter = "Date IN (#12/31/2008#, #1/1/2009#)" // date time values dataView.RowFilter = "Id NOT IN (1, 2, 3)" // values not from the list
    Operator LIKE is used to include only values that match a pattern with wildcards. Wildcard character is * or %, it can be at the beginning of a pattern '*value', at the end 'value*', or at both '*value*'. Wildcard in the middle of a patern 'va*lue' is not allowed.

    [C#]

    dataView.RowFilter = "Name LIKE 'j*'" // values that start with 'j' dataView.RowFilter = "Name LIKE '%jo%'" // values that contain 'jo' dataView.RowFilter = "Name NOT LIKE 'j*'" // values that don't start with 'j'
    If a pattern in a LIKE clause contains any of these special characters * %

    聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    DataView.RowFilter的使用(包括in,like等SQL中的操作符)

    DataView.RowFilter的使用(包括in,like等SQL中的操作符):DataView RowFilter Syntax [C#] This example describes syntax of DataView.RowFil ter expression. It shows how to correctly build expression string (without „SQL injection) using methods to escape values. Column names If a column name
    推薦度:
    • 熱門(mén)焦點(diǎn)

    最新推薦

    猜你喜歡

    熱門(mén)推薦

    專(zhuān)題
    Top
    主站蜘蛛池模板: 香蕉依依精品视频在线播放| 97久久超碰国产精品旧版| 亚洲精品无码久久久久久| 国产精品午夜福利在线无码| 国产精品天天影视久久综合网| 亚洲av日韩精品久久久久久a | 成人伊人精品色XXXX视频| 最新精品露脸国产在线| 97久久精品人人做人人爽| 国产精品伦一区二区三级视频 | 欧美国产成人精品一区二区三区| 国产福利电影一区二区三区,欧美国产成人精品一| 精品无码一区在线观看| 亚洲精品无码午夜福利中文字幕| 日本熟妇亚洲欧美精品区| 国产亚洲精品无码拍拍拍色欲| 国产精品 日韩欧美| 欧美视频精品一区二区三区| 国产精品臀控福利在线观看| 99久久国语露脸精品国产| 99久久99久久久精品齐齐 | 久久久久亚洲精品男人的天堂| 国产精品久操视频| 国产精品成人免费观看 | 91久久精品国产免费直播| 四虎精品成人免费观看| 久久精品国产亚洲麻豆| 国产原创精品视频| 色综合久久精品中文字幕首页| 亚洲国产成人久久精品动漫| 欧美精品香蕉在线观看网| 国产亚洲精品国产| 四虎国产精品免费入口| 国产乱人伦精品一区二区在线观看| 国产精品亚洲高清一区二区| 久久99精品久久久久久噜噜| 日本精品夜色视频一区二区| 亚洲精品成人网站在线观看| 精品国产VA久久久久久久冰| 国产高清在线精品一区| 四虎国产精品永久地址99|