Win2003 64Bit连数据库800a0ea9错误
ken_kang 发表于 2007-6-28 14:28:00
DBPath = Server.MapPath("tek.mdb")
set dbconnection=Server.CREATEOBJECT("ADODB.CONNECTION")
dbconnection.Open "PROVIDER=SQLOLEDB;DATA SOURCE=server;UID=saxe;PWD=tektronix;DATABASE=FLF"
'dbconnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set rs = Server.CreateObject("ADODB.Recordset")
sql="insert into tektronix s('"&name0&"','"&country&"','"&location&"','"&q0&"','"&q1&"','"&q2&"','"&q3&"','"&q4&"','"&q5&"','"&q6&"','"&q7&"','"&q8&"')"
rs.Open sql, dbconnection,1,1
Provider=SQLOLEDB;Data Source=127.0.0.1;Initial Catalog=db;User ID=username;Password=password;
注意看上面的连接语句,=(等号)的左右两边没有空格,就是不要要多余的空格
如果还不行还要注意'(单引号),例:Provider='SQLOLEDB';Data Source='127.0.0.1';Initial Catalog='db';User ID='username';Password='password';
还不行?加上Network Library,例:Provider='SQLOLEDB';Data Source='127.0.0.1';Initial Catalog='db';User ID='username';Password='password';Network Library='dbmssocn';
心得:
SQL 2000的connection string是ConnectionString = "Driver={SQL Server};Server={IP};UID=sa;PWD=pwd;Database=db"
SQL 2005中,driver要換成privider=SQLOLEDB
data source和系統的資料來源設定有關,要看sever設定
initial catalog未必需要,用database就夠用
沒有留言:
張貼留言