ACC97: How to Use Percent, Plus, and Caret Symbols in ASP Forms
2005-06-29 15:37
585 查看
ACC97: How to Use Percent, Plus, and Caret Symbols in ASP Forms
View products that this article applies to.Article ID | : | 163334 |
Last Review | : | November 4, 2003 |
Revision | : | 1.0 |
On this page
![]() | SUMMARY |
![]() | MORE INFORMATION |
![]() | APPLIES TO |
SUMMARY
When you use an Active Server Pages (ASP) form to add or modify data in a Microsoft Access database, if you type the percent (%), plus (+) or caret (^) symbols on the form, those characters may not translate correctly in the database. This article discusses how to modify your ASP form to enable you to use those characters.NOTE: This article contains information about editing ASP files. The information is provided as is. Microsoft Access Product Support Professionals do not support customizing your ASP files.
![]() | Back to the top |
MORE INFORMATION
When you enter data in an ASP form and commit it, some special characters are interpreted at the Web server as part of the VBScript code that executes in the ASP file. When this happens, you may not see the correct characters in your database because the server tries to intercept them and process them. If you want to commit those characters to your database as their keyboard equivalents, you must create a function in the ASP file that translates them into their hexadecimal escape sequences.When Microsoft Access 97 creates ASP files, it automatically creates a VBScript function in the file that translates most special characters back to their keyboard equivalents, such as the number sign (#) and the ampersand (&). If you want to use percent, plus or caret symbols, you must modify the translation function to include those characters as well.
Each form that you export to ASP format creates at least two files: <FormName>.asp and <FormName>alx.asp. The "alx" file contains the translation function you need to modify. The following example shows you how to create and modify an ASP file to accept the percent, plus and caret symbols.
1. | Start Microsoft Access and open the sample database Northwind.mdb. |
2. | Select the Customers form in the Database window. |
3. | On the File menu, click Save As/Export. |
4. | In the Save As dialog box, click "To an External File or Database," and then click OK. |
5. | In the "Save Form 'Customers' In" dialog box, select Microsoft Active Server Pages (*.asp) in the Save As Type box, and select a folder on your Web server where you have Execute permission in the Save In box. Click Export. |
6. | In the Microsoft Active Server Pages Output Options dialog box, type the name of a System DSN on your Web server that connects to the Northwind sample database in the Data Source Name box, and type the uniform resource locator (URL) for the folder on your server where the ASP forms will reside in the Server URL box. Click OK. Two files will be created on your Web server computer: Customers.asp and Customersalx.asp. |
7. | Use a text editor, such as Notepad, to open the Customersalx.asp form on your Web server. |
8. | Locate the MakeHTMLValue function in the file, which looks as follows: Function MakeHTMLValue(szVal) Dim i Dim szRet for i = 1 to Len(szVal) ch = Mid(szVal, i, 1) if ch = " " Then szRet = szRet & "%20" elseif ch = "&" Then szRet = szRet & "%26" elseif ch = "#" Then szRet = szRet & "%23" elseif ch = """" Then szRet = szRet & "%22" elseif ch = ";" Then szRet = szRet & "%3B" elseif ch = ":" Then szRet = szRet & "%3A" elseif ch = "'" Then szRet = szRet & "%27" else szRet = szRet & Mid(szVal, i, 1) end if next MakeHTMLValue = szRet End Function |
9. | Modify the MakeHTMLValue function to include the escape sequences for the percent, plus, and caret symbols so that it looks as follows: Function MakeHTMLValue(szVal) Dim i Dim szRet for i = 1 to Len(szVal) ch = Mid(szVal, i, 1) if ch = " " Then szRet = szRet & "%20" elseif ch = "&" Then szRet = szRet & "%26" elseif ch = "#" Then szRet = szRet & "%23" elseif ch = """" Then szRet = szRet & "%22" elseif ch = ";" Then szRet = szRet & "%3B" elseif ch = ":" Then szRet = szRet & "%3A" elseif ch = "'" Then szRet = szRet & "%27" elseif ch = "%" Then szRet = szRet & "%25" elseif ch = "+" Then szRet = szRet & "%2B" elseif ch = "^" Then szRet = szRet & "%5E" else szRet = szRet & Mid(szVal, i, 1) end if next MakeHTMLValue = szRet End Function |
10. | Save the Customersalx.asp file and close it. |
相关文章推荐
- Know How And When To Use System.Message_Level To Control Messages In Oracle Forms
- How to use Bundle&Minifier and bundleconfig.json in ASP.NET Core
- How to use *args and **kwargs in Python
- What is reflection and how to use it in CSharp ?
- How to use USB 3G dongle/stick Huawei E169/E620/E800 ( Chip used Qualcomm e1750) in Linux (China and world)
- 【摘自Devx】How to pass parameters to Thread in Windows Forms -- and get results back
- use noscript html tag when user disable the javascript in browser, guide user how to enable the js in different browser and retu
- how to use a SQLite database in a standalone program with an HTML interface and VBScript as the programming language
- How to use ConcurrentHashMap in Java - Example Tutorial and Working
- How to use virtual path providers to dynamically load and compile content from virtual paths in
- c++ - How to use wstring and wcout to output Chinese words in Xcode? - Stack Overflow
- Why And When To Use Pre-Update and Pre-Insert Triggers In Oracle Forms
- How to Reference and Use JSTL in your Web Application
- How to use composition and inheritance in visual c# ?
- How to use *args and **kwargs in Python
- How To Use the ODBC .NET Managed Provider in Visual C# .NET and Connection Strings
- How to Update to Metasploit 4 and use Autopwn in Backtrack 5
- Creating a NuGet Package in 7 easy steps - Plus using NuGet to integrate ASP.NET MVC 3 into existing Web Forms applications
- How to use Pageheap.exe in Windows XP, Windows 2000, and Windows Server 2003
- how to accepte the array of the checkbox in asp and in php