ASP从excle导入数据到SQL
'打开XLS.
Set cn = Server.CreateObject("ADODB.Connection")
cn.Provider = "Microsoft.Jet.OLEDB.4.0 "
cn.ConnectionString = "Data Source=" & Server.MapPath("excel/student.xls") & ";" & _
"Extended Properties=Excel 8.0;"
cn.Open
'打开MDB.
connstr="DBQ="+server.MapPath("data/longxiang_mingyang_001.asp")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set oConn=server.CreateObject("ADODB.CONNECTION")
oConn.open connstr
我原来写的是 从excle导入数据到ACCESS,现在我的数据库换成了SQL了,请问该如何修改代码
------解决方案--------------------connstr="Provider=SQLOLEDB;Data source=127.0.0.1;Initial Catalog=dbname;User ID=sa;Password=xxxx;"
------解决方案--------------------oconn.open "driver={SQL Server};server=(local);UID=xxxx;PWD=xxxx;database=xxxx"
oconn.open "driver={SQL Server};server=127.0.0.1
;UID=xxxx;PWD=xxxx;database=xxxx"