Did you find this useful?
Socialize it today.

What is ADOVBS.inc

Tuesday, September 25, 2012

tags ADO

ADOVBS.inc is a file included with IIS that has all of the ADO constants defined. VBScript does not understand ADO constants, such as AdLockReadOnly, the way VB does. The ADOVBS.inc file can be included in your ASP pages to reference the constants. You will see many examples on the web using these constants instead of their integer counterparts so therefore the recommendation is to include ADOVBS.inc in your pages. However, what if you only need to refer to a few of these constants? The ADOVBS.inc file is 15KB in size. Including this file in your ASP pages can add up on memory requirements, especially if you have thousands of users accessing the page at the same given time. If you do have a need to reference many constants, you should include this file, or otherwise, write your own version of this file, with only the handful of constants you need. Here is an example of how to include this file in your ASP pages.

<!DOCTYPE html />
<title>My Page</title>
<!--#include file=adovbs.inc-->
Dim oConn, oRS, oCmd, ds, sql
ds = "Driver={MySQL ODBC 3.51 Driver};SERVER=db-hostname;DATABASE=db-name;UID=userID;PWD=password"
sql = "SELECT empName, empTitle FROM employees"

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open ds

Set oCmd = Server.CreateObject("ADODB.Command") 
oCmd.ActiveConnection = oConn
oCmd.CommandText = sql
oCmd.CommandType = adCmdText
oCmd.Prepared = True

Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.Open oCmd

<!-- More HTML & ASP Code -->


In this example, we referenced the constant "adCmdText". This constant has a value of 1 in the adovbs.inc file. You can find a copy of the adovbs.inc file in the following location on your drive: C:\Program Files\Common Files\System\ado. Copy the file to the root of your web application.

Here is a sample of the contents of the file:

' Microsoft ADO
' Copyright (c) 1996-1998 Microsoft Corporation.
' ADO constants include file for VBScript

'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3

'---- CursorOptionEnum Values ----
Const adHoldRecords = &H00000100
Const adMovePrevious = &H00000200
Const adAddNew = &H01000400
Const adDelete = &H01000800
Const adUpdate = &H01008000
Const adBookmark = &H00002000
Const adApproxPosition = &H00004000
Const adUpdateBatch = &H00010000
Const adResync = &H00020000
Const adNotify = &H00040000
Const adFind = &H00080000
Const adSeek = &H00400000
Const adIndex = &H00800000

'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4


Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.

Recommended Books & Training Resources

ADO: ActiveX Data Objects ADO Programming for Dummies ADO Programmers Reference