Data Access References

This Data Access References refer to DataAccess.asp. There are 2 objects provided :

These objects are used to simplify the process of creating ASP pages for getting & updating data from and to database. To use these objects, you need to include DataAccess.asp in your ASP page :

<B>Error processing SSI file</B><BR>


clsQuery OBJECT

1. ConnectString (property)

The ConnectString property specifies the database connection string.

Example :

Dim oQuery
Set oQuery = New clsQuery
oQuery.ConnectString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & Server.MapPath("\database/grid.mdb")

2. SQL (property)

The SQL property specifies the SQL query.

Example :

Dim oQuery
Set oQuery = New clsQuery
oQuery.SQL = "SELECT Code, TourName, Price FROM Tour"

3. Expression (property)

If you have SQL command :

oQuery.SQL = "SELECT ID, Product, Quantity, Price,  Quantity * Price AS Total FROM Orders"
You need to specify the calculation field as follows :
oQuery.Expression = Array(Array("Total","Quantity*Price"))  

4. PageSize (property)

The PageSize property specifies the number of records displayed on one page.

Example :

oQuery.PageSize	= 10
or, you can get the value from QueryString :
oQuery.PageSize	= Request.QueryString("PageSize")

5. ShowPage (property)

The ShowPage property specifies which page is going to be displayed.

Example :

oQuery.ShowPage	= 1
or, you can get the value from QueryString :
oQuery.ShowPage	= Request.QueryString("ShowPage")

6. OrderBy (property)

The OrderBy property specifies the field to order/sort.

Example :

oQuery.OrderBy	= "Product"
or, you can get the value from QueryString :
oQuery.OrderBy	= Request.QueryString("OrderBy")

7. OrderType (property)

The OrderType property specifies the order type ("ASC" for ascending, "DESC" for descending).

Example :

oQuery.OrderType	= "ASC"
or, you can get the value from QueryString :
oQuery.OrderType = Request.QueryString("OrderType")

8. GetPage (function)

The GetPage function is used to query the database, get the result and transform it to XML DOM.

Example :

Dim oDoc
set oDoc = oQuery.GetPage()
Response.Write oDoc.xml


clsPost OBJECT

1. ConnectString (property)

The ConnectString property specifies the database connection string.

Example :

Dim oPost
Set oPost = New clsPost
oPost.ConnectString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & Server.MapPath("\database/grid.mdb")

2. TableName (property)

The TableName property specifies the table you want to display in a grid.

Example :

oPost.TableName = "Orders"

3. FieldList (property)

The FieldList property specifies the table fields you want to display in a grid.

Example :

oPost.FieldList = Array("CaseDesc","TestResult","Comment","NeedToFix")

4. DataTypes (property)

The DataTypes property specifies the data type for each fields.

Example :

oPost.DataTypes = Array("TEXT","TEXT","TEXT","BOOLEAN")

There are 4 data types that you can choose :

5. PrimaryKeys (property)

The PrimaryKeys property specifies the identity/primary key fields of the table. You can specify more than one field for the PrimaryKeys if your table has composite primary key.

Example :

oPost.PrimaryKeys = Array("TestID")

6. PKDataTypes (property)

The PKDataTypes property specifies the data type for each identity/primary key fields.

Example :

oPost.PKDataTypes = Array("NUMBER")

7. FormatDate (property)

The FormatDate property specifies the format date you want to use.

Example :

oPost.FormatDate = "Mdyyyy"
The FormatDate property can be set to one of the folowing values :

8. DateSeparator (property)

The DateSeparator property specifies the date separator you want to use.

Example :

oPost.DateSeparator = "/"	'for example : 08/19/2002
The DateSeparator property can be set to one of the folowing values :

9. Post (function)

The Post function is used to update the database, based on the modified XML posted by WebGridEXP. The returned value is error messages in XML DOM.

Example :

Dim oDocErr
set oDocErr = oPost.Post()