/*
*/ASP + currently supports two languages: C # ("C Sharp" for short), Visual Basic, and JScript.
Based on habits, in the following language introduction, we use VB and C # to develop Web applications for exercises and routines. if you want to obtain information about. for more information about the Net technology, go to the MS site to view the ngws sdk!
In the list below, you can see a brief introduction to the syntax of the two languages
1. Variable name
C # Syntax
Int x;
String s;
String s1, s2;
Object o;
Object obj = new Object ();
Public String name;
VB syntax
Dim x As Integer
Dim s As String
Dim s1, s2 As String
Dim o 'implicitly Object
Dim obj As New Object ()
Public name As String
2 statement
C #:
Response. Write ("tofu ");
VB:
Response. Write ("tofu ")
3. Comment statement
// Bean curd is made of excellent products
/*
Tofu production
,
All are excellent products
*/
VB:
'Tofu is made of excellent products.
'Tofu making
',
'All are excellent products
4. Get the variable passed by the URL
C #:
String s = Request. QueryString ["Name"];
String value = Request. Cookies ["key"];
VB:
Dim s, value As String
S = Request. QueryString ("Name ")
Value = Request. Cookies ("Key"). Value
5. Declare attributes
C #:
Public String name {
Get {
...
Return ...;
}
Set {
... = Value;
}
}
VB:
Public Property Name As String
Get
...
Return ...;
End Get
Set
... = Value;
End Set
End Property
6. Array
C #
String [] a = new String [3];
A [0] = "1 ";
A [1] = "2 ";
A [2] = "3 ";
// Two-dimensional array
String [] [] a = new String [3] [3];
A [0] [0] = "1 ";
A [1] [0] = "2 ";
A [2] [0] = "3 ";
VB:
Dim a (3) As String
A (0) = "1"
A (1) = "2"
A (2) = "3"
Dim a (3, 3) As String
A (0, 0) = "1"
A (1, 0) = "2"