ASP Migration to ASP.NET
page 2 of 6
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 27051/ 45

This isn't VBScript

Its VB not VBScript

VB.NET isn't the next version of VBScript (that's out the window), its VB, that means that you can take a VB.NET application and plonk it into an ASP.NET page with minor problems. It also allows more functionality in the script and use of some more advanced functionality

Class Animal
private species as string
private id as integer

Sub change_stuff(a as string, optional b as integer = 0)
If Len(id) Then id = b
species = a
End Sub


End Class

I don't think I've ever seen a class in ASP, or the keywords - public and private used. This opens up much more space for people to create custom types without the use of an object. The optional keyword is also something new. I once read an ASP tutorial where the author wrote all the code in VB and then told us how to change it to ASP, that was not only terrible but I first saw the optional keyword and thought that it would be great, its like in C++. Now we can specify optional parameters (with default values) and use them. I can then do the following.

Dim wolf as New Animal
Dim panda as New Animal

wolf.change_stuff("Canis rufus", 2)
panda.change_stuff("Ailuropoda melanoleuca
")

This gives makes wolf.species = "Canis rufus" wold.id = 2 and panda.species = "Ailuropoda melanoleuca" panda.id = 0. Also check out the New keyword being used. This replaces the set keyword in ASP. Instead of -

Set objConn = Server.CreateObject("ADODB.Connection")

We use -

Dim objConn as new OleDBConnection([Connection String and other parameters])

Basically nearly all of VB.NET's functionality rubs off on ASP.NET as well, there may be a few things such as forms to deal with.

There are also many more things of VB.NET that is very useful in ASP.NET such as the try...catch...finally statement. This allows you to try to perform a task, catch any errors and handle them. I will discuss this in more detail in my exception's in ASP.NET article.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 6:51:43 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search