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

$conn = mysql_connection(“127.0.0.1”,”root”,””);



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")

300*300
  • 没有相关文章
  • 没有评论
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.01132 秒