excel中文数据通过ASP导入到access数据库变成问号?
部分代码如下:Setexcconn=Server.CreateObject("ADODB.Connection")Setexcrs=Server.CreateObject...
部分代码如下:
Set excconn=Server.CreateObject("ADODB.Connection")
Set excrs = Server.CreateObject("ADODB.Recordset")
excStrConn="Driver={Microsoft Excel Driver (*.xls)};DriverId=790; DBQ="&Server.MapPath(excpath)
excconn.Open excStrConn
excSql="select * from [Sheet1$]" '查询excel语句
excrs.Open excSql,excconn,2,2
set rs=server.createObject("ADODB.Recordset")
Set conn=Server.CreateObject("ADODB.Connection")
StrConn="provider=microsoft.jet.oledb.4.0; data source="&Server.MapPath("data/equip.mdb")
conn.Open StrConn
sql="select equipid,equipname,equipmodel,equipsn,fdesc,adate from applyequip" '修改
rs.open sql,conn,1,3
do while Not excrs.EOF
if trim(excrs(1))<>"" then 'if capacity is empty then stop
rs.addnew
'response.write "<br>"
for i=0 to 4
'response.write excrs(i)&"=="
rs(i)=trim(excrs(i))
next
rs(5)=date()
rs.update
end if
excrs.MoveNext
Loop
rs.close
set rs=nothing
excrs.close
set excrs=nothing
excConn.close
set excConn=nothing
conn.close
set conn=nothing
response.write"数据导入成功!" 展开
Set excconn=Server.CreateObject("ADODB.Connection")
Set excrs = Server.CreateObject("ADODB.Recordset")
excStrConn="Driver={Microsoft Excel Driver (*.xls)};DriverId=790; DBQ="&Server.MapPath(excpath)
excconn.Open excStrConn
excSql="select * from [Sheet1$]" '查询excel语句
excrs.Open excSql,excconn,2,2
set rs=server.createObject("ADODB.Recordset")
Set conn=Server.CreateObject("ADODB.Connection")
StrConn="provider=microsoft.jet.oledb.4.0; data source="&Server.MapPath("data/equip.mdb")
conn.Open StrConn
sql="select equipid,equipname,equipmodel,equipsn,fdesc,adate from applyequip" '修改
rs.open sql,conn,1,3
do while Not excrs.EOF
if trim(excrs(1))<>"" then 'if capacity is empty then stop
rs.addnew
'response.write "<br>"
for i=0 to 4
'response.write excrs(i)&"=="
rs(i)=trim(excrs(i))
next
rs(5)=date()
rs.update
end if
excrs.MoveNext
Loop
rs.close
set rs=nothing
excrs.close
set excrs=nothing
excConn.close
set excConn=nothing
conn.close
set conn=nothing
response.write"数据导入成功!" 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询