我想要上传了EXCEL文件,相应ID能够写入到字段中。
insert into values 不支持where 怎么办,高手赐教,谢谢。<style>
body {
background-color:#cccccc;
font-size:12px;
}
</style>
<%
'开发:www.aspprogram.cn
'作者:wangsdong
'原创文件,请保留此信息
'友情下载,http://www.codefans.net
addok=request("addok")
if addok="" or isnull(addok) then
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="25" colspan="2" align="center">文件上传</td>
</tr>
<form action="cg_cgjhanyadd.asp?addok=add" method="post" name="setup" id="setup">
<tr>
<td height="25" align="right">标题:</td>
<td height="25"><input name="title" type="text" id="title"></td>
</tr>
<tr>
<td width="25%" height="25" align="right">文件:</td>
<td width="75%" height="25"><input name='path' type='text' id='path' value='' size='40' maxlength='255'>
<input type="button" value="上传..." onClick="window.open('upload.asp?fuptype=pic&fupname=<%=replace(replace(replace(now(),"-",""),":","")," ","")%>&frmname=setup&bdname=path','_blank','scrollbars=yes,resizable=no,width=650,height=450')"></td>
</tr>
<tr>
<td height="25" align="right"> </td>
<td height="25"><input type="submit" value="导入数据"></td>
</tr>
</form>
</table>
<%
end if
if addok="add" then
%>
<!--#include file="codefans_net.conn.asp"-->
<%
Set xlsconn = server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")source1=server.mappath("..")&"\"&replace(request("path"),"/","\")
myConn_Xsl="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &source1& ";Extended Properties=Excel 8.0"
xlsconn.open myConn_Xsl sql="select * from [导入$]"
set rs=xlsconn.execute(sql)
if not rs.eof then
while not rs.eof
id=rs("ID")
wlbm=rs("物料编码")
gys=rs("供应商1")
cgjftime=rs("交付日期1")
cgshuliang=rs("数量1")sql="insert into [cgyl](wlbm,gys,cgjftime,cgshuliang) values('"& wlbm &"','"& gys &"','"& cgjftime &"','"& cgshuliang &"') "
conn.execute(sql)rs.movenext
wendend if
response.write "导入成功"
end if
%>
<!---->
insert into values 不支持where 怎么办,高手赐教,谢谢。<style>
body {
background-color:#cccccc;
font-size:12px;
}
</style>
<%
'开发:www.aspprogram.cn
'作者:wangsdong
'原创文件,请保留此信息
'友情下载,http://www.codefans.net
addok=request("addok")
if addok="" or isnull(addok) then
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="25" colspan="2" align="center">文件上传</td>
</tr>
<form action="cg_cgjhanyadd.asp?addok=add" method="post" name="setup" id="setup">
<tr>
<td height="25" align="right">标题:</td>
<td height="25"><input name="title" type="text" id="title"></td>
</tr>
<tr>
<td width="25%" height="25" align="right">文件:</td>
<td width="75%" height="25"><input name='path' type='text' id='path' value='' size='40' maxlength='255'>
<input type="button" value="上传..." onClick="window.open('upload.asp?fuptype=pic&fupname=<%=replace(replace(replace(now(),"-",""),":","")," ","")%>&frmname=setup&bdname=path','_blank','scrollbars=yes,resizable=no,width=650,height=450')"></td>
</tr>
<tr>
<td height="25" align="right"> </td>
<td height="25"><input type="submit" value="导入数据"></td>
</tr>
</form>
</table>
<%
end if
if addok="add" then
%>
<!--#include file="codefans_net.conn.asp"-->
<%
Set xlsconn = server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")source1=server.mappath("..")&"\"&replace(request("path"),"/","\")
myConn_Xsl="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &source1& ";Extended Properties=Excel 8.0"
xlsconn.open myConn_Xsl sql="select * from [导入$]"
set rs=xlsconn.execute(sql)
if not rs.eof then
while not rs.eof
id=rs("ID")
wlbm=rs("物料编码")
gys=rs("供应商1")
cgjftime=rs("交付日期1")
cgshuliang=rs("数量1")sql="insert into [cgyl](wlbm,gys,cgjftime,cgshuliang) values('"& wlbm &"','"& gys &"','"& cgjftime &"','"& cgshuliang &"') "
conn.execute(sql)rs.movenext
wendend if
response.write "导入成功"
end if
%>
<!---->
解决方案 »
- asp.net开发GPS资料 急急急!
- 100分急求,127.0.0.1访问网站没问题,但192.168.0.2访问就返回404错误???? 谁遇到过,给看看!
- 技术探讨,高手进,顶着有分~~~
- 为什么我的asp.net(C#)项目在调试时对JS脚本程序所作的修改不能即时更新,调试用的代码仍是原来的代码
- asp.net 服务器 怎么 架设
- 请问自定义控件在工具箱中的图标是在哪定义
- 一个插入数据的问题
- 谁能提供数据绑定服务器控件的的实例及详解,谢谢
- 关于同一个服务器的两个虚拟站点之间传递参数
- AJAX自动刷新的一个难题,在线等。
- 关于FCKeditor的问题
- 请问如何在ASP.net页面中,实现当数据库一有新的消息时,客户端就无须刷新页面,自动弹出消息提示页面。
这里用post能上传成功吗?
happytonice:上传没问题Andrewsway:能不能花点时间帮我写下代码,谢谢。刚学不太懂。
先判断id吧,有就用update。
<!--#include file="codefans_net.conn.asp"-->
<%
Set xlsconn = server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")source1=server.mappath("..")&"\"&replace(request("path"),"/","\")
myConn_Xsl="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &source1& ";Extended Properties=Excel 8.0"
xlsconn.open myConn_Xsl sql="select * from [导入$]"
set rs=xlsconn.execute(sql)
if not rs.eof then
while not rs.eof
id=rs("ID")
wlbm=rs("物料编码")
gys=rs("供应商1")
cgjftime=rs("交付日期1")
cgshuliang=rs("数量1")if cgshuliang>0 and cgjftime>now and gys<>"" then
sql="insert into [cgyl](wlbm,gys,cgjftime,cgshuliang) values('"& wlbm &"','"& gys &"','"& cgjftime &"','"& cgshuliang &"') "
conn.execute(sql)
end if
rs.movenext
wendend if
response.write "导入成功"
end if
%>insert into楼主可以参考一下语句 :insert into del_main(ID,物料编码,供应商1,交付日期1,数量1)
select 导入$.ID,导入$.物料编码,导入$.供应商1,导入$.交付日期1,导入$.数量1
from 导入$ where 导入$.ID=<100