国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題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關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

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

來源:懂視網 責編:小采 時間: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
推薦度:
導讀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 * %

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。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
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 欧美精品第一页 | 一区二区三区在线免费视频 | 成人国产精品一区二区网站 | 国产aⅴ一区二区三区 | 成人a毛片免费视频观看 | 欧美日韩ay在线观看 | 欧美视频在线观看免费 | 与子乱刺激对白在线播放 | 国产精品久久久久毛片 | 素人面接 | 日韩专区在线 | 国产欧美日韩另类 | 自拍 欧美 在线 综合 另类 | 亚洲高清视频在线 | 91精品推荐| 亚欧精品在线观看 | 日本久久精品免视看国产成人 | 国产精品v一区二区三区 | 久久久不卡国产精品一区二区 | 久久国产精品最新一区 | 怡红院一区二区三区 | 一区不卡 | 欧美日韩 在线播放 | 亚洲欧美日韩精品专区卡通 | 在线免费观看亚洲视频 | 99热成人精品国产免国语的 | 精品国产日韩亚洲一区91 | 精品国产综合成人亚洲区 | 亚洲 欧洲 另类 综合 自拍 | 91在线中文| 久久亚洲伊人中字综合精品 | 亚洲一级毛片 | 91欧美激情一区二区三区成人 | 欧美国产日韩在线播放 | 久久91精品国产99久久yfo | 精品国产综合区久久久久99 | 91日韩欧美| 亚洲乱码中文论理电影 | 亚洲视频第一页 | 国产69精品久久久久999 | 亚洲一区二区三区精品影院 |