asp 读取excel 值为null
Setconn1=Server.CreateObject("ADODB.Connection")conn1.Open"Driver={MicrosoftExcelDriv...
Set conn1=Server.CreateObject("ADODB.Connection")
conn1.Open"Driver={Microsoft Excel Driver (*.xls)};DriverId=790; DBQ="& Server.MapPath(request.Cookies("memberpic")) '指定excel文件的路径
Set rs1 = Server.CreateObject("ADODB.Recordset")
Sql="select * from [member$]" '指定excel的表名(后面必须有$符号)以及字段名,如果是所有字段名可用*代替
rs1.Open Sql,conn1,2,2
if not rs1.eof then
Set rs = Server.CreateObject("ADODB.Recordset")
Sql="select * from [member_memberinfo]"
rs.Open Sql,conn,1,3
for i=0 to rs1.Fields.Count-1
response.Write(rs1(1))
'response.end
' mclassid=conn.execute("select mclassid from member_memberclass where memberclass='"&rs1(0)&"'")(0)
sql1="select * from [member_adminshop] where shopname='"&rs1(1&"'"
response.Write(cstr(shopname))
上面的response.Write(rs1(1)) 显示正常,可到下面sql1语句,rs1(1)就为null了,请问是什么原因
sql1="select * from [member_adminshop] where shopname='"&rs1(1&"'"
这个地方是复制错误 sql1="select * from [member_adminshop] where shopname='"&rs1(1)&"'"
写法没有错,提示为null
哪位高手做过啊,指点一下啊~~~ 展开
conn1.Open"Driver={Microsoft Excel Driver (*.xls)};DriverId=790; DBQ="& Server.MapPath(request.Cookies("memberpic")) '指定excel文件的路径
Set rs1 = Server.CreateObject("ADODB.Recordset")
Sql="select * from [member$]" '指定excel的表名(后面必须有$符号)以及字段名,如果是所有字段名可用*代替
rs1.Open Sql,conn1,2,2
if not rs1.eof then
Set rs = Server.CreateObject("ADODB.Recordset")
Sql="select * from [member_memberinfo]"
rs.Open Sql,conn,1,3
for i=0 to rs1.Fields.Count-1
response.Write(rs1(1))
'response.end
' mclassid=conn.execute("select mclassid from member_memberclass where memberclass='"&rs1(0)&"'")(0)
sql1="select * from [member_adminshop] where shopname='"&rs1(1&"'"
response.Write(cstr(shopname))
上面的response.Write(rs1(1)) 显示正常,可到下面sql1语句,rs1(1)就为null了,请问是什么原因
sql1="select * from [member_adminshop] where shopname='"&rs1(1&"'"
这个地方是复制错误 sql1="select * from [member_adminshop] where shopname='"&rs1(1)&"'"
写法没有错,提示为null
哪位高手做过啊,指点一下啊~~~ 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询