国产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国产片 | 久久精品福利视频 | 成年全黄大色大黄 | 99热91| 欧美日韩国产中文字幕 | 亚洲欧美日韩综合精品网 | 国产日产欧美精品一区二区三区 | 国产在线观看网站 | 久久精品最新免费国产成人 | 欧美日本一区二区三区 | 国产成人青青热久免费精品 | 亚洲 国产 日韩 欧美 | 久久久久久久久国产 | 欧美在线观看一区 | 中文字幕一区二区三区四区 | 一区二区三区精品 | 国产99久久亚洲综合精品 | 又粗又硬又大又深又爽动态图 | 国产日韩欧美第一页 | 一区二区免费播放 | 91精品国产综合久久久久久 | 国产一区二区三区在线 | 精品国产免费一区二区三区五区 | 欧美另类第一页 | 日韩最新视频一区二区三 | 99久久精品国产一区二区小说 | 日本欧美国产精品第一页久久 | 国产在线视欧美亚综合 | 日韩 国产 欧美 | 日韩 国产 欧美 | 永久免费观看的毛片的网站下载 | 亚洲精品制服丝袜二区 | 国产日韩一区二区三区在线观看 | 在线免费国产视频 | 欧美亚洲另类在线观看 | 日韩欧美网 | 国产69久久精品成人看小说 | 亚洲欧美日韩在线 | 91精品国产综合久久久久久 | 韩国精品一区二区久久 | 亚洲精品国产综合一线久久 |