ASP.NET Web Pages - Tutorial
Easy Learning with "Run Example"
Our "Run Example" tool displays the ASP.NET code and the HTML output simultaneously. Click on the "Run Example" button to see how it works:Web Pages Example
<html> <body> <h1>Hello Web Pages</h1> <p>The time is @DateTime.Now</p> </body> </html> Run ExampleASP.NET Web Pages
Web Pages is one of many programming models for creating ASP.NET web sites and web applications. Web Pages provides an easy way to combine HTML, CSS, and server code: Easy to learn, understand, and use Uses an SPA application model (Single Page Application) Similar to PHP and Classic ASP VB (Visual Basic) or C# (C sharp) scripting languages In addition, Web Pages applications are easily extendable with programmable helpers for databases, videos, graphics, social networking and more.Web Pages Tutorial
If you are new to ASP.NET, Web Pages is a perfect place to start. In this Web Pages tutorial you will learn how to combine HTML, CSS, JavaScript and server code, using server code written in VB or C# . You will also learn how to extend your web pages with programmable Web Helpers.Web Pages Examples
Learn by examples! Because ASP.NET code is executed on the server, you cannot view the code in your browser. You will only see the output as plain HTML. At W3Schools every example displays the hidden ASP.NET code. This makes it easier for you to understand how it works. Web Pages ExamplesWeb Pages References
At the end of this tutorial you will find a complete set of ASP.NET references with objects, components, properties and methods. Web Pages ReferencesASP.NET Web Pages - Adding Razor Code
Razor Markup
Razor is a simple markup syntax for embedding server code (C# or VB) into ASP.NET web pages.Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Web Pages Demo</title> </head> <body> <h1>Hello Web Pages</h1> <p>The time is @DateTime.Now</p> </body> </html> Run example The page above contains both ordinary HTML markup and Razor markup.Razor Syntax for C#
C# code blocks are enclosed in @{ ... } Inline expressions (variables or functions) start with @ Code statements end with semicolon Variables are declared with the var keyword, or the datatype (int, string, etc.) Strings are enclosed with quotation marks C# code is case sensitive C# files have the extension .cshtmlC# Example
<!-- Single statement block --> @{ var myMessage = "Hello World"; } <!-- Inline expression or variable --> <p>The value of myMessage is: @myMessage</p> <!-- Multi-statement block --> @{ var greeting = "Welcome to our site!"; var weekDay = DateTime.Now.DayOfWeek; var greetingMessage = greeting + " Today is: " + weekDay; } <p>The greeting is: @greetingMessage</p> Run exampleRazor Syntax for VB
VB code blocks are enclosed in @Code ... End Code Inline expressions (variables or functions) start with @ Variables are declared with the Dim keyword Strings are enclosed with quotation marks VB code is not case sensitive VB files have the extension .vbhtmlVB Example
<!-- Single statement block --> @Code dim myMessage = "Hello World" End Code <!-- Inline expression or variable --> <p>The value of myMessage is: @myMessage</p> <!-- Multi-statement block --> @Code dim greeting = "Welcome to our site!" dim weekDay = DateTime.Now.DayOfWeek dim greetingMessage = greeting & " Today is: " & weekDay End Code <p>The greeting is: @greetingMessage</p> Run exampleMore About C# and Visual Basic
If you want to learn more about Razor, and the C# and Visual Basic programming languages: Go to the Razor section of this tutorial.ASP.NET Web Pages - Page Layout
consistent layout.A Consistent Look
On the Internet you will discover many web sites with a consistent look and feel: Every page have the same header Every page have the same footer Every page have the same style and layout With Web Pages this can be done very efficiently. You can have reusable blocks of content (content blocks), like headers and footers, in separate files. You can also define a consistent layout for all your pages, using a layout template (layout file).Content Blocks
Many websites have content that is displayed on every page (like headers and footers). With Web Pages you can use the @RenderPage() method to import content from separate files. Content block (from another file) can be imported anywhere in a web page, and can contain text, markup, and code, just like any regular web page. Using common headers and footers as an example, this saves you a lot of work. You don't have to write the same content in every page, and when you change the header or footer files, the content is updated in all your pages. This is how it looks in code:Example
<html> <body> @RenderPage("header.cshtml") <h1>Hello Web Pages</h1> <p>This is a paragraph</p> @RenderPage("footer.cshtml") </body> </html> Run exampleUsing a Layout Page
In the previous section, you saw that including the same content in many web pages is easy. Another approach to creating a consistent look is to use a layout page. A layout page contains the structure, but not the content, of a web page. When a web page (content page) is linked to a layout page, it will be displayed according to the layout page (template). The layout page is just like a normal web page, except from a call to the @RenderBody() method where the content page will be included. Each content page must start with a Layout directive. This is how it looks in code:Layout Page:
<html> <body> <p>This is header text</p> @RenderBody() <p>© 2014 W3Schools. All rights reserved.</p> </body> </html>Any Web Page:
@{Layout="Layout.cshtml";} <h1>Welcome to W3Schools</h1> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laborisnisi ut aliquip ex ea commodo consequat. </p> Run exampleD.R.Y. - Don't Repeat Yourself
With two ASP.NET tools, Content Blocks and Layout Pages, you can give your web applications a consistent look. These tools also save you a lot of work, since you don't have to repeat the same information on all pages. Centralizing markup, style, and code makes web applications much more manageable and easier to maintain.Preventing Files from Being Browsed
With ASP.NET, files with a name that starts with an underscore cannot be browsed from the web. If you want to prevent your content blocks or layout files from being viewed by your users, rename the files to: _header.cshtml _footer.cshtml _Layout.cshtmlHiding Sensitive Information
With ASP.NET, the common way to hide sensitive information (database passwords, email passwords, etc.) is to keep the information in a separate file named "_AppStart"._AppStart.cshtml
@{ WebMail.SmtpServer = "mailserver.example.com"; WebMail.EnableSsl = true; WebMail.UserName = "username@example.com"; WebMail.Password = "your-password"; WebMail.From = "your-name-here@example.com"; } id="mypagediv2" style="position:relative;text-align:center;">ASP.NET Web Pages - Folders
In this chapter you will learn: About Logical and Physical folder structures About Virtual and Physical names About web URLs and PathsLogical Folder Structure
Below is a typical folder structure for an ASP.NET web pages web site:The "Account" folder contains logon and security files The "App_Data" folder contains databases and data files The "Images" folder contains images The "Scripts" folder contains browser scripts The "Shared" folder contains common files (like layout and style files)
Physical Folder Structure
The physical structure for the "Images" folder at the website above might look like this on a computer: C:\Johnny\Documents\MyWebSites\Demo\ImagesVirtual and Physical Names
From the example above: The virtual name of a web picture might be "Images/pic31.jpg". But the physical name is "C:\Johnny\Documents\MyWebSites\Demo\Images\pic31.jpg"URLs and Paths
URLs are used to access files from the web: https://www.w3schools.com/html/html5_intro.asp The URL corresponds to a physical file on a server: C:\MyWebSites\w3schools\html\html5_intro.asp A virtual path is shorthand to represent physical paths. If you use virtual paths, you can move your pages to a different domain (or server) without having to update the paths.
URL | https://www.w3schools.com/html/html5_intro.asp |
Server name | w3schools |
Virtual path | /html/html5_intro.asp |
Physical path | C:\MyWebSites\w3schools\html\html5_intro.asp |
Method | Description |
---|---|
href | Builds a URL using the specified parameters |
RenderBody() | Renders the portion of a content page that is not within a named section (In layout pages) |
RenderPage(page) | Renders the content of one page within another page |
RenderSection(section) | Renders the content of a named section (In layout pages) |
Write(object) | Writes the object as an HTML-encoded string |
WriteLiteral | Writes an object without HTML-encoding it first. |
Property | Description |
---|---|
IsPost | Returns true if the HTTP data transfer method used by the client is a POST request |
Layout | Gets or sets the path of a layout page |
Page | Provides property-like access to data shared between pages and layout pages |
Request | Gets the HttpRequest object for the current HTTP request |
Server | Gets the HttpServerUtility object that provides web-page processing methods |
Method | Description |
---|---|
Database.Execute(SQLstatement [, parameters]) | Executes SQLstatement (with optional parameters) such as INSERT, DELETE, or UPDATE and returns a count of affected records. |
Database.GetLastInsertId() | Returns the identity column from the most recently inserted row. |
Database.Open(filename) Database.Open(connectionStringName) | Opens either the specified database file or the database specified using a named connection string from the Web.config file. |
Database.OpenConnectionString(connectionString) | Opens a database using the connection string. (This contrasts with Database.Open, which uses a connection string name.) |
Database.Query(SQLstatement[, parameters]) | Queries the database using SQLstatement (optionally passing parameters) and returns the results as a collection. |
Database.QuerySingle(SQLstatement [, parameters]) | Executes SQLstatement (with optional parameters) and returns a single record. |
Database.QueryValue(SQLstatement [, parameters]) | Executes SQLstatement (with optional parameters) and returns a single value. |
Helper | Description |
---|---|
Analytics.GetGoogleHtml(webPropertyId) | Renders the Google Analytics JavaScript code for the specified ID. |
Analytics.GetStatCounterHtml(project, security) | Renders the StatCounter Analytics JavaScript code for the specified project. |
Analytics.GetYahooHtml(account) | Renders the Yahoo Analytics JavaScript code for the specified account. |
Helper | Description |
---|---|
Bing.SearchBox([boxWidth]) | Passes a search to Bing. To specify the site to search and a title for the search box, you can set the Bing.SiteUrl and Bing.SiteTitle properties. Normally you set these properties in the _AppStart page. |
Bing.AdvancedSearchBox([, boxWidth] [, resultWidth] [, resultHeight] [, themeColor] [, locale]) | Displays Bing search results in the page with optional formatting. To specify the site to search and a title for the search box, you can set the Bing.SiteUrl and Bing.SiteTitle properties. Normally you set these properties in the _AppStart page. |
Helper | Description |
---|---|
Crypto.Hash(string [, algorithm]) Crypto.Hash(bytes [, algorithm]) | Returns a hash for the specified data. The default algorithm is sha256. |
Helper | Description |
---|---|
Facebook.LikeButton(href [, buttonLayout] [, showFaces] [, width] [, height] [, action] [, font] [, colorScheme] [, refLabel]) | Lets Facebook users make a connection to pages. |
Helper | Description |
---|---|
FileUpload.GetHtml([initialNumberOfFiles] [, allowMoreFilesToBeAdded] [, includeFormTag] [, addText] [, uploadText]) | Renders UI for uploading files. |
Helper | Description |
---|---|
GamerCard.GetHtml(gamerTag) | Renders the specified Xbox gamer tag. |
Helper | Description |
---|---|
Gravatar.GetHtml(email [, imageSize] [, defaultImage] [, rating] [, imageExtension] [, attributes]) | Renders the Gravatar image for the specified email address. |
Helper | Description |
---|---|
Json.Encode(object) | Converts a data object to a string in the JavaScript Object Notation (JSON) format. |
Json.Decode(string) | Converts a JSON-encoded input string to a data object that you can iterate over or insert into a database. |
Helper | Description |
---|---|
LinkShare.GetHtml(pageTitle [, pageLinkBack] [, twitterUserName] [, additionalTweetText] [, linkSites]) | Renders social networking links using the specified title and optional URL. |
Helper | Description |
---|---|
ModelStateDictionary.AddError(key, errorMessage) | Associates an error message with a form field. Use the ModelState helper to access this member. |
ModelStateDictionary.AddFormError(errorMessage) | Associates an error message with a form. Use the ModelState helper to access this member. |
ModelStateDictionary.IsValid | Returns true if there are no validation errors. Use the ModelState helper to access this member. |
Helper | Description |
---|---|
ObjectInfo.Print(value [, depth] [, enumerationLength]) | Renders the properties and values of an object and any child objects. |
Helper | Description |
---|---|
Recaptcha.GetHtml([, publicKey] [, theme] [, language] [, tabIndex]) | Renders the reCAPTCHA verification test. |
ReCaptcha.PublicKey ReCaptcha.PrivateKey | Sets public and private keys for the reCAPTCHA service. Normally you set these properties in the _AppStart page. |
ReCaptcha.Validate([, privateKey]) | Returns the result of the reCAPTCHA test. |
Helper | Description |
---|---|
ServerInfo.GetHtml() | Renders status information about ASP.NET Web Pages. |
Helper | Description |
---|---|
Twitter.Profile(twitterUserName) | Renders a Twitter stream for the specified user. |
Twitter.Search(searchQuery) | Renders a Twitter stream for the specified search text. |
Helper | Description |
---|---|
Video.Flash(filename [, width, height]) | Renders a Flash video player for the specified file with optional width and height. |
Video.MediaPlayer(filename [, width, height]) | Renders a Windows Media player for the specified file with optional width and height. |
Video.Silverlight(filename, width, height) | Renders a Silverlight player for the specified .xap file with required width and height. |
Helper | Description |
---|---|
WebCache.Get(key) | Returns the object specified by key, or null if the object is not found. |
WebCache.Remove(key) | Removes the object specified by key from the cache. |
WebCache.Set(key, value [, minutesToCache] [, slidingExpiration]) | Puts value into the cache under the name specified by key. |
Helper | Description |
---|---|
WebImage(path) | Loads an image from the specified path. |
WebImage.AddImagesWatermark(image) | Adds the specified image as a watermark. |
WebImage.AddTextWatermark(text) | Adds the specified text to the image. |
WebImage.FlipHorizontal() WebImage.FlipVertical() | Flips the image horizontally or vertically. |
WebImage.GetImageFromRequest() | Loads an image when an image is posted to a page during a file upload. |
WebImage.Resize(width, height) | Resizes the image. |
WebImage.RotateLeft() WebImage.RotateRight() | Rotates the image to the left or the right. |
WebImage.Save(path [, imageFormat]) | Saves the image to the specified path. |
Helper | Description |
---|---|
WebGrid(data) | Creates a new WebGrid object using data from a query. |
WebGrid.GetHtml() | Renders markup to display data in an HTML table. |
WebGrid.Pager() | Renders a pager for the WebGrid object. |
Helper | Description |
---|---|
Chart(width, height [, template] [, templatePath]) | Initializes a chart. |
Chart.AddLegend([title] [, name]) | Adds a legend to a chart. |
Chart.AddSeries([name] [, chartType] [, chartArea] [, axisLabel] [, legend] [, markerStep] [, xValue] [, xField] [, yValues] [, yFields] [, options]) | Adds a series of values to the chart. |
Properties | Description |
---|---|
SmtpServer | The name the SMTP server that will send the emails |
SmtpPort | The port the server will use to send SMTP emails |
EnableSsl | True, if the server should use SSL encryption |
UserName | The name of the SMTP account used to send the email |
Password | The password of the SMTP account |
From | The email to appear in the from address |
Method | Description |
---|---|
Send() | Sends an email message to an SMTP server for delivery |
Parameter | Type | Description |
---|---|---|
to | String | The Email recipients (separated by semicolon) |
subject | String | The subject line |
body | String | The body of the message |
Parameter | Type | Description |
---|---|---|
from | String | The email of the sender |
cc | String | The cc emails (separated by semicolon) |
filesToAttach | Collection | Filenames |
isBodyHtml | Boolean | True if the email body is in HTML |
additionalHeaders | Collection | Additional headers |
Name | Value |
---|---|
Class | System.Web.Helpers.WebMail |
Namespace | System.Web.Helpers |
Assembly | System.Web.Helpers.dll |
Properties | Description |
---|---|
CurrentUserId | Gets the ID for the current user |
CurrentUserName | Gets the name of the current user |
HasUserId | Returns true if the current has a user ID |
IsAuthenticated | Returns true if the current user is logged in |
Method | Description |
---|---|
ChangePassword() | Changes the password for a user |
ConfirmAccount() | Confirms an account using a confirmation token |
CreateAccount() | Creates a new user account |
CreateUserAndAccount() | Creates a new user account |
GeneratePasswordResetToken() | Generates a token that can be sent to as user by email |
GetCreateDate() | Gets the time the specified membership was created |
GetPasswordChangeDate() | Gets the date and time when password was changed |
GetUserId() | Gets a user ID from a user name |
InitializeDatabaseConnection() | Initializes the WebSecurity system (database) |
IsConfirmed() | Checks if a user is confirmed |
IsCurrentUser() | Checks if the current user matches a user name |
Login() | Logs the user in by setting a token in the cookie |
Logout() | Logs the user out by removing the token cookie |
RequireAuthenticatedUser() | Exits the page if the user is not an authenticated user |
RequireRoles() | Exits the page if the user is not a part of the specified roles |
RequireUser() | Exits the page if the user is not the specified user |
ResetPassword() | Changes a user's password using a token |
UserExists() | Checks if a given user exists |
UserId | |
---|---|
1 | john@johnson.net |
2 | peter@peterson.com |
3 | lars@larson.eut |
User Id | Create Date | Confirmation Token | Is Confirmed | Last Password Failure | Password | Password Change |
---|---|---|---|---|---|---|
1 | 12.04.2012 16:12:17 | NULL | True | NULL | AFNQhWfy.... | 12.04.2012 16:12:17 |
Method | Description |
---|---|
AsBool(), AsBool(true|false) | Converts a string value to a Boolean value (true/false). Returns false or the specified value if the string does not represent true/false. |
AsDateTime(), AsDateTime(value) | Converts a string value to date/time. Returns DateTime. MinValue or the specified value if the string does not represent a date/time. |
AsDecimal(), AsDecimal(value) | Converts a string value to a decimal value. Returns 0.0 or the specified value if the string does not represent a decimal value. |
AsFloat(), AsFloat(value) | Converts a string value to a float. Returns 0.0 or the specified value if the string does not represent a decimal value. |
AsInt(), AsInt(value) | Converts a string value to an integer. Returns 0 or the specified value if the string does not represent an integer. |
Href(path [, param1 [, param2]]) | Creates a browser-compatible URL from a local file path, with optional additional path parts. |
Html.Raw(value) | Renders value as HTML markup instead of rendering it as HTML-encoded output. |
IsBool(), IsDateTime(), IsDecimal(), IsFloat(), IsInt() | Returns true if the value can be converted from a string to the specified type. |
IsEmpty() | Returns true if the object or variable has no value. |
IsPost | Returns true if the request is a POST. (Initial requests are usually a GET.) |
Layout | Specifies the path of a layout page to apply to this page. |
PageData[key], PageData[index], Page | Contains data shared between the page, layout pages, and partial pages in the current request. You can use the dynamic Page property to access the same data, as in the following example: |
RenderBody() | (Layout pages) Renders the content of a content page that is not in any named sections. |
RenderPage(path, values) RenderPage(path[, param1 [, param2]]) | Renders a content page using the specified path and optional extra data. You can get the values of the extra parameters from PageData by position (example 1) or key (example 2). |
RenderSection(sectionName [, required = true|false]) | (Layout pages) Renders a content section that has a name. Set required to false to make a section optional. |
Request.Cookies[key] | Gets or sets the value of an HTTP cookie. |
Request.Files[key] | Gets the files that were uploaded in the current request. |
Request.Form[key] | Gets data that was posted in a form (as strings). Request[key] checks both the Request.Form and the Request.QueryString collections. |
Request.QueryString[key] | Gets data that was specified in the URL query string. Request[key] checks both the Request.Form and the Request.QueryString collections. |
Request.Unvalidated(key) Request.Unvalidated().QueryString|Form|Cookies|Headers[key] | Selectively disables request validation for a form element, query-string value, cookie, or header value. Request validation is enabled by default and prevents users from posting markup or other potentially dangerous content. |
Response.AddHeader(name, value) | Adds an HTTP server header to the response. |
Response.OutputCache(seconds [, sliding] [, varyByParams]) | Caches the page output for a specified time. Optionally set sliding to reset the timeout on each page access and varyByParams to cache different versions of the page for each different query string in the page request. |
Response.Redirect(path) | Redirects the browser request to a new location. |
Response.SetStatus(httpStatusCode) | Sets the HTTP status code sent to the browser. |
Response.WriteBinary(data [, mimetype]) | Writes the contents of data to the response with an optional MIME type. |
Response.WriteFile(file) | Writes the contents of a file to the response. |
@section(sectionName) { content } | (Layout pages) Defines a content section that has a name. |
Server.HtmlDecode(htmlText) | Decodes a string that is HTML encoded. |
Server.HtmlEncode(text) | Encodes a string for rendering in HTML markup. |
Server.MapPath(virtualPath) | Returns the server physical path for the specified virtual path. |
Server.UrlDecode(urlText) | Decodes text from a URL. |
Server.UrlEncode(text) | Encodes text to put in a URL. |
Session[key] | Gets or sets a value that exists until the user closes the browser. |
ToString() | Displays a string representation of the object's value. |
UrlData[index] | Gets additional data from the URL (for example, /MyPage/ExtraData). |
Type | Description | Examples |
---|---|---|
int | Integer (whole numbers) | 103, 12, 5168 |
float | Floating-point number | 3.14, 3.4e38 |
decimal | Decimal number (higher precision) | 1037.196543 |
bool | Boolean | true, false |
string | String | "Hello W3Schools", "John" |
Operator | Description | Example |
---|---|---|
= | Assigns a value to a variable. | i=6 |
+ - * / | Adds a value or variable. Subtracts a value or variable. Multiplies a value or variable. Divides a value or variable. | i=5+5 i=5-5 i=5*5 i=5/5 |
+= -= | Increments a variable. Decrements a variable. | i += 1 i -= 1 |
== | Equality. Returns true if values are equal. | if (i==10) |
!= | Inequality. Returns true if values are not equal. | if (i!=10) |
< > <= >= | Less than. Greater than. Less than or equal. Greater than or equal. | if (i<10) if (i>10) if (i<=10) if (i>=10) |
+ | Adding strings (concatenation). | "w3" + "schools" |
. | Dot. Separate objects and methods. | DateTime.Hour |
() | Parenthesis. Groups values. | (i+5) |
() | Parenthesis. Passes parameters. | x=Add(i,5) |
[] | Brackets. Accesses values in arrays or collections. | name[3] |
! | Not. Reverses true or false. | if (!ready) |
&& || | Logical AND. Logical OR. | if (ready && clear) if (ready || clear) |
Method | Description | Example |
---|---|---|
AsInt() IsInt() | Converts a string to an integer. | if (myString.IsInt()) {myInt=myString.AsInt();} |
AsFloat() IsFloat() | Converts a string to a floating-point number. | if (myString.IsFloat()) {myFloat=myString.AsFloat();} |
AsDecimal() IsDecimal() | Converts a string to a decimal number. | if (myString.IsDecimal()) {myDec=myString.AsDecimal();} |
AsDateTime() IsDateTime() | Converts a string to an ASP.NET DateTime type. | myString="10/10/2012"; myDate=myString.AsDateTime(); |
AsBool() IsBool() | Converts a string to a Boolean. | myString="True"; myBool=myString.AsBool(); |
ToString() | Converts any data type to a string. | myInt=1234; myString=myInt.ToString(); |
Type | Description | Examples |
---|---|---|
integer | Integer (whole numbers) | 103, 12, 5168 |
double | 64 bit floating-point number | 3.14, 3.4e38 |
decimal | Decimal number (higher precision) | 1037.196543 |
boolean | Boolean | true, false |
string | String | "Hello W3Schools", "John" |
Operator | Description | Example |
---|---|---|
= | Assigns a value to a variable. | i=6 |
+ - * / | Adds a value or variable. Subtracts a value or variable. Multiplies a value or variable. Divides a value or variable. | i=5+5 i=5-5 i=5*5 i=5/5 |
+= -= | Increments a variable. Decrements a variable. | i += 1 i -= 1 |
= | Equality. Returns true if values are equal. | if i=10 |
<> | Inequality. Returns true if values are not equal. | if <>10 |
< > <= >= | Less than. Greater than. Less than or equal. Greater than or equal. | if i<10 if i>10 if i<=10 if i>=10 |
& | Adding strings (concatenation). | "w3" & "schools" |
. | Dot. Separate objects and methods. | DateTime.Hour |
() | Parenthesis. Groups values. | (i+5) |
() | Parenthesis. Passes parameters. | x=Add(i,5) |
() | Parenthesis. Accesses values in arrays or collections. | name(3) |
Not | Not. Reverses true or false. | if Not ready |
And OR | Logical AND. Logical OR. | if ready And clear if ready Or clear |
AndAlso orElse | Extended Logical AND. Extended Logical OR. | if ready AndAlso clear if ready OrElse clear |
Method | Decryptions | Example |
---|---|---|
AsInt() IsInt() | Converts a string to an integer. | if myString.IsInt() then myInt=myString.AsInt() end if |
AsFloat() IsFloat() | Converts a string to a floating-point number. | if myString.IsFloat() then myFloat=myString.AsFloat() end if |
AsDecimal() IsDecimal() | Converts a string to a decimal number. | if myString.IsDecimal() then myDec=myString.AsDecimal() end if |
AsDateTime() IsDateTime() | Converts a string to an ASP.NET DateTime type. | myString="10/10/2012" myDate=myString.AsDateTime() |
AsBool() IsBool() | Converts a string to a Boolean. | myString="True" myBool=myString.AsBool() |
ToString() | Converts any data type to a string. | myInt=1234 myString=myInt.ToString() |
Parameter | Description |
---|---|
scope | Sets the scope of the object (either Session or Application) |
id | Specifies a unique id for the object |
ProgID | An id associated with a class id. The format for ProgID is [Vendor.]Component[.Version] Either ProgID or ClassID must be specified. |
ClassID | Specifies a unique id for a COM class object. Either ProgID or ClassID must be specified. |
Parameter | Description |
---|---|
file | Specifies an absolute path to a type library. Either the file parameter or the uuid parameter is required |
uuid | Specifies a unique identifier for the type library. Either the file parameter or the uuid parameter is required |
version | Optional. Used for selecting version. If the requested version is not found, then the most recent version is used |
lcid | Optional. The locale identifier to be used for the type library |
Error Code | Description |
---|---|
ASP 0222 | Invalid type library specification |
ASP 0223 | Type library not found |
ASP 0224 | Type library cannot be loaded |
ASP 0225 | Type library cannot be wrapped |
Date/Time functions Conversion functions Format functions | Math functions Array functions | String functions Other functions |
Function | Description |
---|---|
CDate | Converts a valid date and time expression to the variant of subtype Date |
Date | Returns the current system date |
DateAdd | Returns a date to which a specified time interval has been added |
DateDiff | Returns the number of intervals between two dates |
DatePart | Returns the specified part of a given date |
DateSerial | Returns the date for a specified year, month, and day |
DateValue | Returns a date |
Day | Returns a number that represents the day of the month (between 1 and 31, inclusive) |
FormatDateTime | Returns an expression formatted as a date or time |
Hour | Returns a number that represents the hour of the day (between 0 and 23, inclusive) |
IsDate | Returns a Boolean value that indicates if the evaluated expression can be converted to a date |
Minute | Returns a number that represents the minute of the hour (between 0 and 59, inclusive) |
Month | Returns a number that represents the month of the year (between 1 and 12, inclusive) |
MonthName | Returns the name of a specified month |
Now | Returns the current system date and time |
Second | Returns a number that represents the second of the minute (between 0 and 59, inclusive) |
Time | Returns the current system time |
Timer | Returns the number of seconds since 12:00 AM |
TimeSerial | Returns the time for a specific hour, minute, and second |
TimeValue | Returns a time |
Weekday | Returns a number that represents the day of the week (between 1 and 7, inclusive) |
WeekdayName | Returns the weekday name of a specified day of the week |
Year | Returns a number that represents the year |
Function | Description |
---|---|
Asc | Converts the first letter in a string to ANSI code |
CBool | Converts an expression to a variant of subtype Boolean |
CByte | Converts an expression to a variant of subtype Byte |
CCur | Converts an expression to a variant of subtype Currency |
CDate | Converts a valid date and time expression to the variant of subtype Date |
CDbl | Converts an expression to a variant of subtype Double |
Chr | Converts the specified ANSI code to a character |
CInt | Converts an expression to a variant of subtype Integer |
CLng | Converts an expression to a variant of subtype Long |
CSng | Converts an expression to a variant of subtype Single |
CStr | Converts an expression to a variant of subtype String |
Hex | Returns the hexadecimal value of a specified number |
Oct | Returns the octal value of a specified number |
Function | Description |
---|---|
FormatCurrency | Returns an expression formatted as a currency value |
FormatDateTime | Returns an expression formatted as a date or time |
FormatNumber | Returns an expression formatted as a number |
FormatPercent | Returns an expression formatted as a percentage |
Function | Description |
---|---|
Abs | Returns the absolute value of a specified number |
Atn | Returns the arctangent of a specified number |
Cos | Returns the cosine of a specified number (angle) |
Exp | Returns e raised to a power |
Hex | Returns the hexadecimal value of a specified number |
Int | Returns the integer part of a specified number |
Fix | Returns the integer part of a specified number |
Log | Returns the natural logarithm of a specified number |
Oct | Returns the octal value of a specified number |
Rnd | Returns a random number less than 1 but greater or equal to 0 |
Sgn | Returns an integer that indicates the sign of a specified number |
Sin | Returns the sine of a specified number (angle) |
Sqr | Returns the square root of a specified number |
Tan | Returns the tangent of a specified number (angle) |
Function | Description |
---|---|
Array | Returns a variant containing an array |
Filter | Returns a zero-based array that contains a subset of a string array based on a filter criteria |
IsArray | Returns a Boolean value that indicates whether a specified variable is an array |
Join | Returns a string that consists of a number of substrings in an array |
LBound | Returns the smallest subscript for the indicated dimension of an array |
Split | Returns a zero-based, one-dimensional array that contains a specified number of substrings |
UBound | Returns the largest subscript for the indicated dimension of an array |
Function | Description |
---|---|
InStr | Returns the position of the first occurrence of one string within another. The search begins at the first character of the string |
InStrRev | Returns the position of the first occurrence of one string within another. The search begins at the last character of the string |
LCase | Converts a specified string to lowercase |
Left | Returns a specified number of characters from the left side of a string |
Len | Returns the number of characters in a string |
LTrim | Removes spaces on the left side of a string |
RTrim | Removes spaces on the right side of a string |
Trim | Removes spaces on both the left and the right side of a string |
Mid | Returns a specified number of characters from a string |
Replace | Replaces a specified part of a string with another string a specified number of times |
Right | Returns a specified number of characters from the right side of a string |
Space | Returns a string that consists of a specified number of spaces |
StrComp | Compares two strings and returns a value that represents the result of the comparison |
String | Returns a string that contains a repeating character of a specified length |
StrReverse | Reverses a string |
UCase | Converts a specified string to uppercase |
Function | Description |
---|---|
CreateObject | Creates an object of a specified type |
Eval | Evaluates an expression and returns the result |
IsEmpty | Returns a Boolean value that indicates whether a specified variable has been initialized or not |
IsNull | Returns a Boolean value that indicates whether a specified expression contains no valid data (Null) |
IsNumeric | Returns a Boolean value that indicates whether a specified expression can be evaluated as a number |
IsObject | Returns a Boolean value that indicates whether the specified expression is an automation object |
RGB | Returns a number that represents an RGB color value |
Round | Rounds a number |
ScriptEngine | Returns the scripting language in use |
ScriptEngineBuildVersion | Returns the build version number of the scripting engine in use |
ScriptEngineMajorVersion | Returns the major version number of the scripting engine in use |
ScriptEngineMinorVersion | Returns the minor version number of the scripting engine in use |
TypeName | Returns the subtype of a specified variable |
VarType | Returns a value that indicates the subtype of a specified variable |
Keyword | Description |
---|---|
Empty | Used to indicate an uninitialized variable value. A variable value is uninitialized when it is first created and no value is assigned to it, or when a variable value is explicitly set to empty. Example: Dim x 'the variable x is uninitialized! x="ff" 'the variable x is NOT uninitialized anymore x=Empty 'the variable x is uninitialized! Note: This is not the same as Null!! |
IsEmpty | Used to test if a variable is uninitialized. Example: If (IsEmpty(x)) 'is x uninitialized? |
Nothing | Used to indicate an uninitialized object value, or to disassociate an object variable from an object to release system resources.Example: Set myObject=Nothing |
Is Nothing | Used to test if a value is an initialized object. Example: If (myObject Is Nothing) 'is it unset? Note: If you compare a value to Nothing, you will not get the right result! Example: If (myObject = Nothing) 'always false! |
Null | Used to indicate that a variable contains no valid data. One way to think of Null is that someone has explicitly set the value to "invalid", unlike Empty where the value is "not set". Note: This is not the same as Empty or Nothing!! Example: x=Null 'x contains no valid data |
IsNull | Used to test if a value contains invalid data. Example: if (IsNull(x)) 'is x invalid? |
True | Used to indicate a Boolean condition that is correct |
False | Used to indicate a Boolean condition that is not correct (False has a value of 0) |
Collection | Description |
---|---|
Cookies | Sets a cookie value. If the cookie does not exist, it will be created, and take the value that is specified |
Property | Description |
---|---|
Buffer | Specifies whether to buffer the page output or not |
CacheControl | Sets whether a proxy server can cache the output generated by ASP or not |
Charset | Appends the name of a character-set to the content-type header in the Response object |
ContentType | Sets the HTTP content type for the Response object |
Expires | Sets how long (in minutes) a page will be cached on a browser before it expires |
ExpiresAbsolute | Sets a date and time when a page cached on a browser will expire |
IsClientConnected | Indicates if the client has disconnected from the server |
Pics | Appends a value to the PICS label response header |
Status | Specifies the value of the status line returned by the server |
Method | Description |
---|---|
AddHeader | Adds a new HTTP header and a value to the HTTP response |
AppendToLog | Adds a string to the end of the server log entry |
BinaryWrite | Writes data directly to the output without any character conversion |
Clear | Clears any buffered HTML output |
End | Stops processing a script, and returns the current result |
Flush | Sends buffered HTML output immediately |
Redirect | Redirects the user to a different URL |
Write | Writes a specified string to the output |
Collection | Description |
---|---|
ClientCertificate | Contains all the field values stored in the client certificate |
Cookies | Contains all the cookie values sent in a HTTP request |
Form | Contains all the form (input) values from a form that uses the post method |
QueryString | Contains all the variable values in a HTTP query string |
ServerVariables | Contains all the server variable values |
Property | Description |
---|---|
TotalBytes | Returns the total number of bytes the client sent in the body of the request |
Method | Description |
---|---|
BinaryRead | Retrieves the data sent to the server from the client as part of a post request and stores it in a safe array |
Collection | Description |
---|---|
Contents | Contains all the items appended to the application through a script command |
StaticObjects | Contains all the objects appended to the application with the HTML <object> tag |
Method | Description |
---|---|
Contents.Remove | Deletes an item from the Contents collection |
Contents.RemoveAll() | Deletes all items from the Contents collection |
Lock | Prevents other users from modifying the variables in the Application object |
Unlock | Enables other users to modify the variables in the Application object (after it has been locked using the Lock method) |
Event | Description |
---|---|
Application_OnEnd | Occurs when all user sessions are over, and the application ends |
Application_OnStart | Occurs before the first new session is created (when the Application object is first referenced) |
Collection | Description |
---|---|
Contents | Contains all the items appended to the session through a script command |
StaticObjects | Contains all the objects appended to the session with the HTML <object> tag |
Property | Description |
---|---|
CodePage | Specifies the character set that will be used when displaying dynamic content |
LCID | Sets or returns an integer that specifies a location or region. Contents like date, time, and currency will be displayed according to that location or region |
SessionID | Returns a unique id for each user. The unique id is generated by the server |
Timeout | Sets or returns the timeout period (in minutes) for the Session object in this application |
Method | Description |
---|---|
Abandon | Destroys a user session |
Contents.Remove | Deletes an item from the Contents collection |
Contents.RemoveAll() | Deletes all items from the Contents collection |
Event | Description |
---|---|
Session_OnEnd | Occurs when a session ends |
Session_OnStart | Occurs when a session starts |
Property | Description |
---|---|
ScriptTimeout | Sets or returns the maximum number of seconds a script can run before it is terminated |
Method | Description |
---|---|
CreateObject | Creates an instance of an object |
Execute | Executes an ASP file from inside another ASP file |
GetLastError() | Returns an ASPError object that describes the error condition that occurred |
HTMLEncode | Applies HTML encoding to a specified string |
MapPath | Maps a specified path to a physical path |
Transfer | Sends (transfers) all the information created in one ASP file to a second ASP file |
URLEncode | Applies URL encoding rules to a specified string |
Property | Description |
---|---|
ASPCode | Returns an error code generated by IIS |
ASPDescription | Returns a detailed description of the error (if the error is ASP-related) |
Category | Returns the source of the error (was the error generated by ASP? By a scripting language? By an object?) |
Column | Returns the column position within the file that generated the error |
Description | Returns a short description of the error |
File | Returns the name of the ASP file that generated the error |
Line | Returns the line number where the error was detected |
Number | Returns the standard COM error code for the error |
Source | Returns the actual source code of the line where the error occurred |
Property | Description |
---|---|
Drives | Returns a collection of all Drive objects on the computer |
Method | Description |
---|---|
BuildPath | Appends a name to an existing path |
CopyFile | Copies one or more files from one location to another |
CopyFolder | Copies one or more folders from one location to another |
CreateFolder | Creates a new folder |
CreateTextFile | Creates a text file and returns a TextStream object that can be used to read from, or write to the file |
DeleteFile | Deletes one or more specified files |
DeleteFolder | Deletes one or more specified folders |
DriveExists | Checks if a specified drive exists |
FileExists | Checks if a specified file exists |
FolderExists | Checks if a specified folder exists |
GetAbsolutePathName | Returns the complete path from the root of the drive for the specified path |
GetBaseName | Returns the base name of a specified file or folder |
GetDrive | Returns a Drive object corresponding to the drive in a specified path |
GetDriveName | Returns the drive name of a specified path |
GetExtensionName | Returns the file extension name for the last component in a specified path |
GetFile | Returns a File object for a specified path |
GetFileName | Returns the file name or folder name for the last component in a specified path |
GetFolder | Returns a Folder object for a specified path |
GetParentFolderName | Returns the name of the parent folder of the last component in a specified path |
GetSpecialFolder | Returns the path to some of Windows' special folders |
GetTempName | Returns a randomly generated temporary file or folder |
MoveFile | Moves one or more files from one location to another |
MoveFolder | Moves one or more folders from one location to another |
OpenTextFile | Opens a file and returns a TextStream object that can be used to access the file |
Property | Description |
---|---|
AtEndOfLine | Returns true if the file pointer is positioned immediately before the end-of-line marker in a TextStream file, and false if not |
AtEndOfStream | Returns true if the file pointer is at the end of a TextStream file, and false if not |
Column | Returns the column number of the current character position in an input stream |
Line | Returns the current line number in a TextStream file |
Method | Description |
---|---|
Close | Closes an open TextStream file |
Read | Reads a specified number of characters from a TextStream file and returns the result |
ReadAll | Reads an entire TextStream file and returns the result |
ReadLine | Reads one line from a TextStream file and returns the result |
Skip | Skips a specified number of characters when reading a TextStream file |
SkipLine | Skips the next line when reading a TextStream file |
Write | Writes a specified text to a TextStream file |
WriteLine | Writes a specified text and a new-line character to a TextStream file |
WriteBlankLines | Writes a specified number of new-line character to a TextStream file |
Property | Description |
---|---|
AvailableSpace | Returns the amount of available space to a user on a specified drive or network share |
DriveLetter | Returns one uppercase letter that identifies the local drive or a network share |
DriveType | Returns the type of a specified drive |
FileSystem | Returns the file system in use for a specified drive |
FreeSpace | Returns the amount of free space to a user on a specified drive or network share |
IsReady | Returns true if the specified drive is ready and false if not |
Path | Returns an uppercase letter followed by a colon that indicates the path name for a specified drive |
RootFolder | Returns a Folder object that represents the root folder of a specified drive |
SerialNumber | Returns the serial number of a specified drive |
ShareName | Returns the network share name for a specified drive |
TotalSize | Returns the total size of a specified drive or network share |
VolumeName | Sets or returns the volume name of a specified drive |
Property | Description |
---|---|
Attributes | Sets or returns the attributes of a specified file |
DateCreated | Returns the date and time when a specified file was created |
DateLastAccessed | Returns the date and time when a specified file was last accessed |
DateLastModified | Returns the date and time when a specified file was last modified |
Drive | Returns the drive letter of the drive where a specified file or folder resides |
Name | Sets or returns the name of a specified file |
ParentFolder | Returns the folder object for the parent of the specified file |
Path | Returns the path for a specified file |
ShortName | Returns the short name of a specified file (the 8.3 naming convention) |
ShortPath | Returns the short path of a specified file (the 8.3 naming convention) |
Size | Returns the size, in bytes, of a specified file |
Type | Returns the type of a specified file |
Method | Description |
---|---|
Copy | Copies a specified file from one location to another |
Delete | Deletes a specified file |
Move | Moves a specified file from one location to another |
OpenAsTextStream | Opens a specified file and returns a TextStream object to access the file |
Collection | Description |
---|---|
Files | Returns a collection of all the files in a specified folder |
SubFolders | Returns a collection of all subfolders in a specified folder |
Property | Description |
---|---|
Attributes | Sets or returns the attributes of a specified folder |
DateCreated | Returns the date and time when a specified folder was created |
DateLastAccessed | Returns the date and time when a specified folder was last accessed |
DateLastModified | Returns the date and time when a specified folder was last modified |
Drive | Returns the drive letter of the drive where the specified folder resides |
IsRootFolder | Returns true if a folder is the root folder and false if not |
Name | Sets or returns the name of a specified folder |
ParentFolder | Returns the parent folder of a specified folder |
Path | Returns the path for a specified folder |
ShortName | Returns the short name of a specified folder (the 8.3 naming convention) |
ShortPath | Returns the short path of a specified folder (the 8.3 naming convention) |
Size | Returns the size of a specified folder |
Type | Returns the type of a specified folder |
Method | Description |
---|---|
Copy | Copies a specified folder from one location to another |
Delete | Deletes a specified folder |
Move | Moves a specified folder from one location to another |
CreateTextFile | Creates a new text file in the specified folder and returns a TextStream object to access the file |
Property | Description |
---|---|
CompareMode | Sets or returns the comparison mode for comparing keys in a Dictionary object |
Count | Returns the number of key/item pairs in a Dictionary object |
Item | Sets or returns the value of an item in a Dictionary object |
Key | Sets a new key value for an existing key value in a Dictionary object |
Method | Description |
---|---|
Add | Adds a new key/item pair to a Dictionary object |
Exists | Returns a Boolean value that indicates whether a specified key exists in the Dictionary object |
Items | Returns an array of all the items in a Dictionary object |
Keys | Returns an array of all the keys in a Dictionary object |
Remove | Removes one specified key/item pair from the Dictionary object |
RemoveAll | Removes all the key/item pairs in the Dictionary object |
Property | Description | Example |
---|---|---|
Border | Specifies the size of the borders around the advertisement | <% set adrot=Server.CreateObject("MSWC.AdRotator") adrot.Border="2" Response.Write(adrot.GetAdvertisement("ads.txt")) %> |
Clickable | Specifies whether the advertisement is a hyperlink | <% set adrot=Server.CreateObject("MSWC.AdRotator") adrot.Clickable=false Response.Write(adrot.GetAdvertisement("ads.txt")) %> |
TargetFrame | Name of the frame to display the advertisement | <% set adrot=Server.CreateObject("MSWC.AdRotator") adrot.TargetFrame="target='_blank'" Response.Write(adrot.GetAdvertisement("ads.txt")) %> |
Method | Description | Example |
---|---|---|
GetAdvertisement | Returns HTML that displays the advertisement in the page | <% set adrot=Server.CreateObject("MSWC.AdRotator") Response.Write(adrot.GetAdvertisement("ads.txt")) %> |
Client OS | WinNT |
---|---|
Web Browser | IE |
Browser version | 5.0 |
Frame support? | True |
Table support? | True |
Sound support? | True |
Cookies support? | True |
VBScript support? | True |
JavaScript support? | True |
Parameter | Description |
---|---|
comments | Optional. Any line that starts with a semicolon are ignored by the BrowserType object |
HTTPUserAgentHeader | Optional. Specifies the HTTP User Agent header to associate with the browser-property value statements specified in propertyN. Wildcard characters are allowed |
browserDefinition | Optional. Specifies the HTTP User Agent header-string of a browser to use as the parent browser. The current browser's definition will inherit all of the property values declared in the parent browser's definition |
propertyN | Optional. Specifies the browser properties. The following table lists some possible properties: ActiveXControls - Support ActiveX controls? Backgroundsounds - Support background sounds? Cdf - Support Channel Definition Format for Webcasting? Tables - Support tables? Cookies - Support cookies? Frames - Support frames? Javaapplets - Support Java applets? Javascript - Supports JScript? Vbscript - Supports VBScript? Browser - Specifies the name of the browser Beta - Is the browser beta software? Platform - Specifies the platform that the browser runs on Version - Specifies the version number of the browser |
valueN | Optional. Specifies the value of propertyN. Can be a string, an integer (prefix with #), or a Boolean value |
defaultPropertyN | Optional. Specifies the name of the browser property to which to assign a default value if none of the defined HTTPUserAgentHeader values match the HTTP User Agent header sent by the browser |
defaultValueN | Optional. Specifies the value of defaultPropertyN. Can be a string, an integer (prefix with #), or a Boolean value |
Method | Description | Example |
---|---|---|
GetListCount | Returns the number of items listed in the Content Linking List file | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetListCount("links.txt") Response.Write("There are ") Response.Write(c) Response.Write(" items in the list") %>Output: There are 4 items in the list |
GetListIndex | Returns the index number of the current item in the Content Linking List file. The index number of the first item is 1. 0 is returned if the current page is not in the Content Linking List file | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetListIndex("links.txt") Response.Write("Item number ") Response.Write(c) %>Output: Item number 3 |
GetNextDescription | Returns the text description of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the last page on the list | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNextDescription("links.txt") Response.Write("Next ") Response.Write("description is: ") Response.Write(c) %>Next description is: ASP Variables |
GetNextURL | Returns the URL of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the last page on the list | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNextURL("links.txt") Response.Write("Next ") Response.Write("URL is: ") Response.Write(c) %>Next URL is: asp_variables.asp |
GetNthDescription | Returns the description of the Nth page listed in the Content Linking List file | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNthDescription("links.txt",3) Response.Write("Third ") Response.Write("description is: ") Response.Write(c) %>Third description is: ASP Variables |
GetNthURL | Returns the URL of the Nth page listed in the Content Linking List file | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNthURL("links.txt",3) Response.Write("Third ") Response.Write("URL is: ") Response.Write(c) %>Third URL is: asp_variables.asp |
GetPreviousDescription | Returns the text description of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the first page on the list | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetPreviousDescription("links.txt") Response.Write("Previous ") Response.Write("description is: ") Response.Write(c) %>Previous description is: ASP Variables |
GetPreviousURL | Returns the URL of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the first page on the list | <% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetPreviousURL("links.txt") Response.Write("Previous ") Response.Write("URL is: ") Response.Write(c) %>Previous URL is: asp_variables.asp |
Method | Description | Example |
---|---|---|
ChooseContent | Gets and displays a content string | <%
dim cr
Set cr=Server.CreateObject("MSWC.ContentRotator")
response.write(cr.ChooseContent("text/textads.txt"))
%>Output:
![]() |
GetAllContent | Retrieves and displays all of the content strings in the text file | <%
dim cr
Set cr=Server.CreateObject("MSWC.ContentRotator")
response.write(cr.GetAllContent("text/textads.txt"))
%>
Output:
This is a great day!!![]() |
Property | Description |
---|---|
ActiveConnection | Sets or returns a definition for a connection if the connection is closed, or the current Connection object if the connection is open |
CommandText | Sets or returns a provider command |
CommandTimeout | Sets or returns the number of seconds to wait while attempting to execute a command |
CommandType | Sets or returns the type of a Command object |
Name | Sets or returns the name of a Command object |
Prepared | Sets or returns a Boolean value that, if set to True, indicates that the command should save a prepared version of the query before the first execution |
State | Returns a value that describes if the Command object is open, closed, connecting, executing or retrieving data |
Method | Description |
---|---|
Cancel | Cancels an execution of a method |
CreateParameter | Creates a new Parameter object |
Execute | Executes the query, SQL statement or procedure in the CommandText property |
Collection | Description |
---|---|
Parameters | Contains all the Parameter objects of a Command Object |
Properties | Contains all the Property objects of a Command Object |
Property | Description |
---|---|
Attributes | Sets or returns the attributes of a Connection object |
CommandTimeout | Sets or returns the number of seconds to wait while attempting to execute a command |
ConnectionString | Sets or returns the details used to create a connection to a data source |
ConnectionTimeout | Sets or returns the number of seconds to wait for a connection to open |
CursorLocation | Sets or returns the location of the cursor service |
DefaultDatabase | Sets or returns the default database name |
IsolationLevel | Sets or returns the isolation level |
Mode | Sets or returns the provider access permission |
Provider | Sets or returns the provider name |
State | Returns a value describing if the connection is open or closed |
Version | Returns the ADO version number |
Method | Description |
---|---|
BeginTrans | Begins a new transaction |
Cancel | Cancels an execution |
Close | Closes a connection |
CommitTrans | Saves any changes and ends the current transaction |
Execute | Executes a query, statement, procedure or provider specific text |
Open | Opens a connection |
OpenSchema | Returns schema information from the provider about the data source |
RollbackTrans | Cancels any changes in the current transaction and ends the transaction |
Event | Description |
---|---|
BeginTransComplete | Triggered after the BeginTrans operation |
CommitTransComplete | Triggered after the CommitTrans operation |
ConnectComplete | Triggered after a connection starts |
Disconnect | Triggered after a connection ends |
ExecuteComplete | Triggered after a command has finished executing |
InfoMessage | Triggered if a warning occurs during a ConnectionEvent operation |
RollbackTransComplete | Triggered after the RollbackTrans operation |
WillConnect | Triggered before a connection starts |
WillExecute | Triggered before a command is executed |
Collection | Description |
---|---|
Errors | Contains all the Error objects of the Connection object |
Properties | Contains all the Property objects of the Connection object |
Property | Description |
---|---|
Description | Returns an error description |
HelpContext | Returns the context ID of a topic in the Microsoft Windows help system |
HelpFile | Returns the full path of the help file in the Microsoft Windows help system |
NativeError | Returns an error code from the provider or the data source |
Number | Returns a unique number that identifies the error |
Source | Returns the name of the object or application that generated the error |
SQLState | Returns a 5-character SQL error code |
Property | Description |
---|---|
ActualSize | Returns the actual length of a field's value |
Attributes | Sets or returns the attributes of a Field object |
DefinedSize | Returns the defined size of a field |
Name | Sets or returns the name of a Field object |
NumericScale | Sets or returns the number of decimal places allowed for numeric values in a Field object |
OriginalValue | Returns the original value of a field |
Precision | Sets or returns the maximum number of digits allowed when representing numeric values in a Field object |
Status | Returns the status of a Field object |
Type | Sets or returns the type of a Field object |
UnderlyingValue | Returns the current value of a field |
Value | Sets or returns the value of a Field object |
Method | Description |
---|---|
AppendChunk | Appends long binary or character data to a Field object |
GetChunk | Returns all or a part of the contents of a large text or binary data Field object |
Collection | Description |
---|---|
Properties | Contains all the Property objects for a Field object |
Property | Description |
---|---|
Attributes | Sets or returns the attributes of a Parameter object |
Direction | Sets or returns how a parameter is passed to or from a procedure |
Name | Sets or returns the name of a Parameter object |
NumericScale | Sets or returns the number of digits stored to the right side of the decimal point for a numeric value of a Parameter object |
Precision | Sets or returns the maximum number of digits allowed when representing numeric values in a Parameter |
Size | Sets or returns the maximum size in bytes or characters of a value in a Parameter object |
Type | Sets or returns the type of a Parameter object |
Value | Sets or returns the value of a Parameter object |
Method | Description |
---|---|
AppendChunk | Appends long binary or character data to a Parameter object |
Delete | Deletes an object from the Parameters Collection |
Property | Description |
---|---|
Attributes | Returns the attributes of a Property object |
Name | Sets or returns the name of a Property object |
Type | Returns the type of a Property object |
Value | Sets or returns the value of a Property object |
Property | Description |
---|---|
ActiveConnection | Sets or returns which Connection object a Record object belongs to |
Mode | Sets or returns the permission for modifying data in a Record object |
ParentURL | Returns the absolute URL of the parent Record |
RecordType | Returns the type of a Record object |
Source | Sets or returns the src parameter of the Open method of a Record object |
State | Returns the status of a Record object |
Method | Description |
---|---|
Cancel | Cancels an execution of a CopyRecord, DeleteRecord, MoveRecord, or Open call |
Close | Closes a Record object |
CopyRecord | Copies a file or directory to another location |
DeleteRecord | Deletes a file or directory |
GetChildren | Returns a Recordset object where each row represents the files in the directory |
MoveRecord | Moves a file or a directory to another location |
Open | Opens an existing Record object or creates a new file or directory |
Collection | Description |
---|---|
Properties | A collection of provider-specific properties |
Fields | Contains all the Field objects in the Record object |
Property | Description |
---|---|
Count | Returns the number of items in the fields collection. Starts at zero. Example: countfields=rec.Fields.Count |
Item(named_item/number) | Returns a specified item in the fields collection. Example: itemfields=rec.Fields.Item(1) or itemfields = rec.Fields.Item("Name") |
Property | Description |
---|---|
AbsolutePage | Sets or returns a value that specifies the page number in the Recordset object |
AbsolutePosition | Sets or returns a value that specifies the ordinal position of the current record in the Recordset object |
ActiveCommand | Returns the Command object associated with the Recordset |
ActiveConnection | Sets or returns a definition for a connection if the connection is closed, or the current Connection object if the connection is open |
BOF | Returns true if the current record position is before the first record, otherwise false |
Bookmark | Sets or returns a bookmark. The bookmark saves the position of the current record |
CacheSize | Sets or returns the number of records that can be cached |
CursorLocation | Sets or returns the location of the cursor service |
CursorType | Sets or returns the cursor type of a Recordset object |
DataMember | Sets or returns the name of the data member that will be retrieved from the object referenced by the DataSource property |
DataSource | Specifies an object containing data to be represented as a Recordset object |
EditMode | Returns the editing status of the current record |
EOF | Returns true if the current record position is after the last record, otherwise false |
Filter | Sets or returns a filter for the data in a Recordset object |
Index | Sets or returns the name of the current index for a Recordset object |
LockType | Sets or returns a value that specifies the type of locking when editing a record in a Recordset |
MarshalOptions | Sets or returns a value that specifies which records are to be returned to the server |
MaxRecords | Sets or returns the maximum number of records to return to a Recordset object from a query |
PageCount | Returns the number of pages with data in a Recordset object |
PageSize | Sets or returns the maximum number of records allowed on a single page of a Recordset object |
RecordCount | Returns the number of records in a Recordset object |
Sort | Sets or returns the field names in the Recordset to sort on |
Source | Sets a string value or a Command object reference, or returns a String value that indicates the data source of the Recordset object |
State | Returns a value that describes if the Recordset object is open, closed, connecting, executing or retrieving data |
Status | Returns the status of the current record with regard to batch updates or other bulk operations |
StayInSync | Sets or returns whether the reference to the child records will change when the parent record position changes |
Method | Description |
---|---|
AddNew | Creates a new record |
Cancel | Cancels an execution |
CancelBatch | Cancels a batch update |
CancelUpdate | Cancels changes made to a record of a Recordset object |
Clone | Creates a duplicate of an existing Recordset |
Close | Closes a Recordset |
CompareBookmarks | Compares two bookmarks |
Delete | Deletes a record or a group of records |
Find | Searches for a record in a Recordset that satisfies a specified criteria |
GetRows | Copies multiple records from a Recordset object into a two-dimensional array |
GetString | Returns a Recordset as a string |
Move | Moves the record pointer in a Recordset object |
MoveFirst | Moves the record pointer to the first record |
MoveLast | Moves the record pointer to the last record |
MoveNext | Moves the record pointer to the next record |
MovePrevious | Moves the record pointer to the previous record |
NextRecordset | Clears the current Recordset object and returns the next Recordset object by looping through a series of commands |
Open | Opens a database element that gives you access to records in a table, the results of a query, or to a saved Recordset |
Requery | Updates the data in a Recordset by re-executing the query that made the original Recordset |
Resync | Refreshes the data in the current Recordset from the original database |
Save | Saves a Recordset object to a file or a Stream object |
Seek | Searches the index of a Recordset to find a record that matches the specified values |
Supports | Returns a boolean value that defines whether or not a Recordset object supports a specific type of functionality |
Update | Saves all changes made to a single record in a Recordset object |
UpdateBatch | Saves all changes in a Recordset to the database. Used when working in batch update mode |
Event | Description |
---|---|
EndOfRecordset | Triggered when you try to move to a record after the last record |
FetchComplete | Triggered after all records in an asynchronous operation have been fetched |
FetchProgress | Triggered periodically in an asynchronous operation, to state how many more records that have been fetched |
FieldChangeComplete | Triggered after the value of a Field object change |
MoveComplete | Triggered after the current position in the Recordset has changed |
RecordChangeComplete | Triggered after a record has changed |
RecordsetChangeComplete | Triggered after the Recordset has changed |
WillChangeField | Triggered before the value of a Field object change |
WillChangeRecord | Triggered before a record change |
WillChangeRecordset | Triggered before a Recordset change |
WillMove | Triggered before the current position in the Recordset changes |
Collection | Description |
---|---|
Fields | Indicates the number of Field objects in the Recordset object |
Properties | Contains all the Property objects in the Recordset object |
Property | Description |
---|---|
Count | Returns the number of items in the fields collection. Starts at zero. Example: countfields=rs.Fields.Count |
Item(named_item/number) | Returns a specified item in the fields collection. Example: itemfields=rs.Fields.Item(1) or itemfields=rs.Fields.Item("Name") |
Property | Description |
---|---|
Count | Returns the number of items in the properties collection. Starts at zero. Example: countprop=rs.Properties.Count |
Item(named_item/number) | Returns a specified item in the properties collection. Example: itemprop = rs.Properties.Item(1) or itemprop=rs.Properties.Item("Name") |
Property | Description |
---|---|
CharSet | Sets or returns a value that specifies into which character set the contents are to be translated. This property is only used with text Stream objects (type is adTypeText) |
EOS | Returns whether the current position is at the end of the stream or not |
LineSeparator | Sets or returns the line separator character used in a text Stream object |
Mode | Sets or returns the available permissions for modifying data |
Position | Sets or returns the current position (in bytes) from the beginning of a Stream object |
Size | Returns the size of an open Stream object |
State | Returns a value describing if the Stream object is open or closed |
Type | Sets or returns the type of data in a Stream object |
Method | Description |
---|---|
Cancel | Cancels an execution of an Open call on a Stream object |
Close | Closes a Stream object |
CopyTo | Copies a specified number of characters/bytes from one Stream object into another Stream object |
Flush | Sends the contents of the Stream buffer to the associated underlying object |
LoadFromFile | Loads the contents of a file into a Stream object |
Open | Opens a Stream object |
Read | Reads the entire stream or a specified number of bytes from a binary Stream object |
ReadText | Reads the entire stream, a line, or a specified number of characters from a text Stream object |
SaveToFile | Saves the binary contents of a Stream object to a file |
SetEOS | Sets the current position to be the end of the stream (EOS) |
SkipLine | Skips a line when reading a text Stream |
Write | Writes binary data to a binary Stream object |
WriteText | Writes character data to a text Stream object |
DataType Enum | Value | Access | SQLServer | Oracle |
---|---|---|---|---|
adBigInt | 20 | BigInt (SQL Server 2000 +) | ||
adBinary | 128 | Binary TimeStamp | Raw * | |
adBoolean | 11 | YesNo | Bit | |
adChar | 129 | Char | Char | |
adCurrency | 6 | Currency | Money SmallMoney | |
adDate | 7 | Date | DateTime | |
adDBTimeStamp | 135 | DateTime (Access 97 (ODBC)) | DateTime SmallDateTime | Date |
adDecimal | 14 | Decimal * | ||
adDouble | 5 | Double | Float | Float |
adGUID | 72 | ReplicationID (Access 97 (OLEDB)), (Access 2000 (OLEDB)) | UniqueIdentifier (SQL Server 7.0 +) | |
adIDispatch | 9 | |||
adInteger | 3 | AutoNumber Integer Long | Identity (SQL Server 6.5) Int | Int * |
adLongVarBinary | 205 | OLEObject | Image | Long Raw * Blob (Oracle 8.1.x) |
adLongVarChar | 201 | Memo (Access 97) Hyperlink (Access 97) | Text | Long * Clob (Oracle 8.1.x) |
adLongVarWChar | 203 | Memo (Access 2000 (OLEDB)) Hyperlink (Access 2000 (OLEDB)) | NText (SQL Server 7.0 +) | NClob (Oracle 8.1.x) |
adNumeric | 131 | Decimal (Access 2000 (OLEDB)) | Decimal Numeric | Decimal Integer Number SmallInt |
adSingle | 4 | Single | Real | |
adSmallInt | 2 | Integer | SmallInt | |
adUnsignedTinyInt | 17 | Byte | TinyInt | |
adVarBinary | 204 | ReplicationID (Access 97) | VarBinary | |
adVarChar | 200 | Text (Access 97) | VarChar | VarChar |
adVariant | 12 | Sql_Variant (SQL Server 2000 +) | VarChar2 | |
adVarWChar | 202 | Text (Access 2000 (OLEDB)) | NVarChar (SQL Server 7.0 +) | NVarChar2 |
adWChar | 130 | NChar (SQL Server 7.0 +) |