Data | Database 2) Create a Recordset object with a password MDB database that is similar to a Recordset object that creates an MDB database without a password, but one more password parameter, that is, the password information must be given when connecting to the database.
Function createsecuredmdbrecordset (database file name, data table name or SELECT statement, password)
Dim Conn,provider,dbpath
' Create a Connection object
Set conn = Server.CreateObject ("ADODB. Connection ")
Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
DBPath = "Data source=" & Server.MapPath ("Database file name")
' Connect to the database, note the following line with password parameters
Conn. Open Provider & dbpath& "Jet oledb:database password=" &assword
Set Createsecuredmdbrecordset = Server.CreateObject ("ADODB. Recordset ")
' Open data table, parameter two is connection object
Createsecuredmdbrecordset.open "datasheet name", Conn, 2, 2
End Function
3 DBF file is not a standard database file, only corresponds to a data table in the standard database file, so in order to use DBF file, put all DBF files in a directory, so that the directory name as the standard Data database table, each DBF file corresponds to the standard database data table. In the following function directory is the directory name of DBF,
Function createdbfrecordset (directory name, DBF filename, or SELECT statement)
Dim Conn,driver,sourcetype,dbpath
' Create a Connection object
Set conn = Server.CreateObject ("ADODB. Connection ")
Driver = "Driver={microsoft Visual FoxPro Driver};"
SourceType = "SOURCETYPE=DBF;"
DBPath = "sourcedb=" & Server.MapPath ("Directory Name")
' Invoke the Open method to open the database
Conn. Open Driver & sourcetype & DBPath
Set Createdbfrecordset = Server.CreateObject ("ADODB. Recordset ")
' Open DBF file, parameter two is connection object
Createdbfrecordset.open DBF filename or SELECT statement, Conn, 2, 2
End Function