Tutorials to .com

Tutorials to .com » Asp » Database » Using ASP to access a variety of commonly used type of database (3)

Using ASP to access a variety of commonly used type of database (3)

Print View , by: iSee ,Total views: 6 ,Word Count: 477 ,Date: Mon, 25 May 2009 Time: 12:39 AM

Function CreateSecuredMdbRecordset (database files, and data sheets or Select statement, password)

Dim conn, Provider, DBPath

'Connection object the establishment of
Set conn = Server.CreateObject ( "ADODB.Connection")
Provider = "Provider = Microsoft.Jet.OLEDB.4.0;"
DBPath = "Data Source =" & Server.MapPath ( "Database file name")
'Connect to database, and his attention to the following parameters with password
conn.Open Provider & DBPath & "Jet OLEDB: database Password =" & assword
Set CreateSecuredMdbRecordset = Server.CreateObject ( "ADODB.Recordset")
'Open the data table, parameter b for the Connection object
CreateSecuredMdbRecordset.Open "data table", conn, 2, 2

End Function


3) DBF files is not a standard database files, only equivalent to the standard database file in a data table, so in order to use DBF files, using all the DBF files in a directory, the directory name such as standard data the database tables, each document is equivalent to the standard database DBF table. Directory is the following function of the directory name where the DBF,

Function CreateDbfRecordset (directory name, DBF files or Select statement)

Dim conn, Driver, SourceType, DBPath

'Connection object the establishment of
Set conn = Server.CreateObject ( "ADODB.Connection")
Driver = "Driver = (Microsoft Visual foxpro Driver);"
SourceType = "SourceType = DBF;"
DBPath = "SourceDB =" & Server.MapPath ( "directory name")

'Call the Open method to open the database
conn.Open Driver & SourceType & DBPath

Set CreateDbfRecordset = Server.CreateObject ( "ADODB.Recordset")
'Open the DBF file, parameter b for the Connection object
CreateDbfRecordset.Open DBF file name or Select statement, conn, 2, 2

End Function

4) generated by the Foxpro database with MDB database DBC is similar to a database contains several data form, so access to the DBC database MDB database with similar methods.

Function CreateDbcRecordset (DBC database file name, data tables or Select statement)

Dim conn, Driver, SourceType, DBPath

'Connection object the establishment of
Set conn = Server.CreateObject ( "ADODB.Connection")
Driver = "Driver = (Microsoft Visual FoxPro Driver);"
SourceType = "SourceType = DBC;"


ASP Database Related Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.