DataFunctions Object Overview
The DataFunctions object is usually created in the Global.asa file. Use the Active Server Pages (ASP) Server object’s CreateObject method to create a DataFunctions object, as follows:
Set MSCSDataFunctions = Server.CreateObject("Commerce.DataFunctions")
MSCSDataFunctions.Locale = &H0409
Also in Global.asa, store the new object in the Application object, as follows:
Set Application("MSCSDataFunctions") = MSCSDataFunctions
Because the Page object’s Request methods rely on the DataFunctions object for its implementation of these methods, you must create the DataFunctions object before you create a Page object.
The DataFunctions object supports methods that make it possible to perform locale-based data type conversions and value range validation on values submitted to your site, or submitted by your site to the OPP or the site’s database.
This object’s methods fall into two categories:
-
υThe conversion methods convert string expressions of date, currency, or number values to Variant expressions of those values, or from Variants to strings. Thus, a string expression of a date value is converted to a Date Variant that contains that value, and this conversion is performed based on the locale that you specify. Conversely, you can use DataFunctions methods to convert a Date value to a string expression of that value.
-
υThe validation methods ensure that the data you submit for storage in the database falls within the validation rules that you have prescribed for given fields. For example, if you create a field in a Microsoft® SQL Server™ database table that is of data type varchar and that can store a maximum of 50 characters, you can use the DataFunctions object’s CleanString method to ensure that the string is sized appropriately for storage in that field.
© 1997-1998 Microsoft Corporation. All rights reserved.