In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you what ADO.NET functions have, which are concise and easy to understand, which can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
The use of functions to make our programming more convenient, a function can achieve a function, let us greatly reduce the amount of code, here we briefly introduce the ADO.NET function.
If you want the column to contain expressions with more complex logic, you can embed some ADO.NET functions in the column. Expressions can contain functions such as Len, Iif, IsNull, Convert, Trim, and Substring. These ADO.NET functions provide more flexibility in building expressions. The Len function calculates the length of the string:
ODs.Tables ["OrderDetail"] .Columns.add ("LengthOfProductName", typeof (int), "Len (ProductName)")
The Iif function is an iterative If statement, like IIf in Visual Basic .NET. It has three parameters and calculates the true and false of * parameters. If the calculated value of the * parameter is true, the second argument is returned from the Iif function, otherwise the third argument is returned. The following is basically a condensed If...Then...Else statement that can be simply written as an embedded expression:
ODs.Tables ["OrderDetail"] .Columns.Add ("Inventory", typeof (string), "Iif (Quantity < 10 few left', 'Plenty in stock')")
The IsNull function evaluates * * parameters to see if they are equal to System.DbNull. If the result of the calculation is false, the function returns * * parameter values, and if true, the second parameter value. This is used when null values are not allowed and you want to replace them with empty strings or placeholders:
ODs.Tables ["OrderDetail"] .Columns.add ("DiscountString", typeof (string), "IsNull (Discount,'[null value]')")
The Trim function removes the space at the end of the string value. The Convert function converts the data type in the expression to the data type referred to in the second argument of the ADO.NET function. The Substring function returns a portion of a string, which can be used to shorten a long string and display only fixed-length strings. It can return any part of the string and use oDs.Tables ["OrderDetail"] .Columns.Add ("ShortProduct", typeof (string), "Substring (ProductName, 1,10)"); as needed.
What are the ADO.NET functions mentioned above? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.