Porting ASP code to VB COM component (ext. 2)

Source: Internet
Author: User

Preparing files

Author: green Apple Computer Studio
Article Hits: 351
When you write ASP code that can save time, there's a lot to do if you want to migrate code. Follow these steps and you will
There's no trouble finding porting code.
Declaring variable types
The biggest disadvantage of Visual Basic and VBScript is that it allows developers to use variables without declaring them. If you think it's a good thing,
So when you're looking for the whole evening to look for a logic mistake caused by a small typo, you don't think about it anymore. If you use
"Option Explicit" (explicit option) to enforce a clear declaration, the IDE warns of this.
<%@ language=vbscript% >
<% Option Explicit% >
When you use Option Explicit, remember that it is just below @ declarations. Not noticing this would lead to a little
Error message.
Microsoft VBScript compilation error ' 800a0400 '
Expected statement
/test.asp, line 4
Option Explicit
^
Now the challenge is here. VBScript allows a variable to be any data type, as long as it is variant. That means that you can only put variables
Declared as variants. This is very wasteful in many ways, but it can be accepted in ASP. But in Visual Basic, when the
When you may create more efficient code, the variable is defined as a type. This program is simple, just add "as" after the declaration
[Data_type] ", then it is no longer a simple variant.
For example, now there is a variable that is a string. Open an ASP page and type "Dim strsession as String". And then
Preview this page and you'll get a little surprise.
Microsoft VBScript compilation error ' 800a0401 '
Expected end of statement
/icu/temp.asp, Line 3
Dim Strsession as String
---------------^
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.