asp,php连接数据库大全
Asp连接数据库推荐用ACCESS,MSSQL
ASP+ACCESS
Conn.open=”provider=microsoft.jet.oledb.4.0;data source=”&server.mappath(“数据库路径”)
ASP+MSSQL
Conn.open=”provider=sqloledb;server=127.0.0.1;uid=sa;pwd=admin;database=wm”
ASP+MYSQL
conn.open="driver={MYSQLODBC 3.51 DRIVER};uid=root;pwd=;database=HR_MOVE;server=127.0.0.1"
ASP+SQLITE
A conn.open="DSN=SQL_WM;DRIVER={SQLite3 ODBC Driver}"
B conn.open="DRIVER={SQLite3 ODBC Driver};DATABASE=D:\SQLITE\WWWW"
ASP+PostgreSQL
conn.open="DRIVER={PostgreSQL ANSI};server=127.0.0.1;uid=itnows;pwd=000000;database=test1"
php连接数据库推荐用PHP+MYSQL
PHP+ACCESS
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("workermove.mdb");
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
$rs->Open(SQL语句,$conn,1,1);
PHP+MSSQL
<?
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={SQL SERVER};SERVER=127.0.0.1\GSQL;UID=SA;PWD=ADMIN;DATABASE=WORKMOVE";
$conn->Open($connstr);
?>
PHP+MYSQL
$
PHP+SQLITE
①$db = sqlite_open("sqlite.db");适合于sqlite2版本
②$conn = new SQLITE3("路径"); 适合用于sqlite3版本
③
④也可调用odbc方式连接sqlite
PHP+PostgreSQL
$conn_string =@pg_connect("host=127.0.0.1 port=5432 dbname=test1 user=itnows password=000000")
- 没有相关文章
- 没有评论