| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1343 人关注过本帖
标题:为什么不能修改图片啊?只能删除图片?
取消只看楼主 加入收藏
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:13 
为什么不能修改图片啊?只能删除图片?
/////////////////这是图片显示处理页面。
<tr>
            
        <% dim rs,sql,page,i,NewsTitle,cpgg,ProName,NewsTitle2
    sql="select ProAddress,ProName,ProType,ID,NewsTitle2,cpgg from Product  order by id desc "
    Set rs = Server.CreateObject ("ADODB.Recordset")
    rs.open sql,conn,1,1
    if rs.eof then
        response.write("<tr><td colpan=""4"">暂无图片</td></tr>")
        rs.pagesize=15
    else
        page=Request.QueryString("page")
        rs.PageSize = 15
        if Not IsEmpty(page) then
            if Not IsNumeric(page) then
                page=1
            else
                Page = cint(page)
            end if   
            if Page > rs.PageCount then  Page = rs.PageCount      
            if Page <= 0 then  Page = 1
        else
            Page = 1
        end if
        rs.AbsolutePage = Page
        For i = 1 to rs.PageSize
        if rs.EOF then Exit For
     
    %>
        <td height="160" align="center" valign="middle">
            <table cellpadding="0" cellspacing="0">
      <tr>
        <td class="tdbg"><img height="100" width="126" border="0" src=<%=rs(0)%>></td>
      </tr>
      <tr><br>
            <tr><td height="20" align="center" >
        
          名称:<input name="NewsTitle2" type="text" id="NewsTitle2" value="<%=rs(4)%>" size="15" maxlength="50"></td>
      </tr>
      <tr><td height="20" align="center" >
        
          规格:<input name="cpgg" type="text" id="cpgg" value="<%=rs(5)%>" size="15" maxlength="50"></td>
      </tr>
      <tr>
        <td height="20" align="center"> &nbsp;
          &nbsp; <input name="Submit2" onClick="if(confirm('确定删除?'))DeleteData(<%=rs(3)%>)" type="button" id="Submit" value="删除" />
          &nbsp; <input name="Submit" onClick="if(confirm('确定修改?'))UpdateData(0)" type="button" id="Submit" value="修改"><input type="hidden" name="NewsFile" value="0"><input name="IsFile" type="hidden" value="0" /></td>
      </tr>
    </table>
          </td>
         
        <%
        if i=5 or i=10  then
        response.write("</tr><tr>")
        end if
        rs.movenext
        next
        end if
        %>
        </tr>
        <tr>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;PAGE:&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_pic.asp?page=1">1</a><% for i=2 to rs.pagecount %>
        |&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_pic.asp?page=<%=i%>"><%=i%></a>
        <% next %></td>
        </tr>
</table>
</body>
</html>
<script language="javascript">
function DeleteData(ID)
{        
    var postInfo = "PostType=Products&Actions=Delete&ID="+ID;
    var eZuStudio = new ActiveXObject("Microsoft.XMLHTTP");
    eZuStudio.open("POST","PostData.asp",false);
    eZuStudio.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    eZuStudio.send(postInfo);
    alert(unescape(eZuStudio.responseText));
    window.location.reload();
}
</script>
<script language="javascript">
var reData=null;
var eZuStudio;
var ProType;
function UpdateData(IsFile)
{   

    var NewsTitle2=escape(document.all.NewsTitle2.value);
    var cpgg=escape(document.all.cpgg.value);
    ProType=escape("<%=ProType%>");
    var postInfo = "PostType=News&Actions=Modify";
    postInfo=postInfo+"&NewsTitle2="+NewsTitle2+"&cpgg="+cpgg+"&ProType="+ProType;
    postInfo=postInfo+"&ID=<%=ID%>";
    eZuStudio=new ActiveXObject("Microsoft.XMLHTTP");
    eZuSdtio.onreadystatechange=alertContents;
    eZuStudio.open("POST","PostData.asp",false);
    eZuStudio.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    eZuStudio.send(postInfo);
}
function alertContents()
{
  if(eZuStudio.readyState==4)
  {
     if(eZuStudio.status==200)
     {
           alert(unescape(eZuStudio.responseText));
           window.location.href="Admin_Pic.asp?ProType="+ProType;
     }
  }
  else
  {
     //没有接收到数据或出错处理代码
  }
}
</script>
////////////////////////PostData.asp代码如下:

'产品信息管理///////////////////////////////////////////////////////////
sub Products()
dim Actions
Actions=SafeInput(Request("Actions"))
Select case Actions
case "Modify"
call ModifyNews()
case "Delete"
call DeleteProducts()
case "Add"
call AddProducts()
end select
end sub

sub AddProducts()
dim sql,ProName,ProAddress,ProDate,NewsFile,ProType,NewsTitle2,cpgg
ProType=SafeInput(unescape(Request.Form("ProName.value")))
ProName=SafeInput(unescape(Request.Form("ProName")))
NewsFile=unescape(Request.Form("NewsFile"))
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
'NewsFile="a"
'ProDate=time()
    sql="insert into Product (ProName,ProAddress,ProType,NewsTitle2,cpgg) values "
    sql=sql&"('"&ProType&"','"&NewsFile&"','"&ProType&"','"&NewsTitle2&"','"&cpgg&"')"
    conn.execute(sql)
    Response.Write(escape("添加成功!"))
end sub

sub ModifyNews()
dim sql,ProName,ProType,NewsTitle2,cpgg,ID
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="update Product Set cpgg='"&cpgg&"',NewsTitle2='"&NewsTitle2
sql=sql&" where ID="&ID
on error resume next
conn.execute(sql)
'Response.write(sql)'停止执行后面代码
'Response.end()'停止执行后面代码
Response.Write(escape("修改成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub

sub DeleteProducts()
dim sql,ID
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="delete from Product where ID="&ID
conn.execute(sql)
Response.Write(escape("删除成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub
搜索更多相关主题的帖子: 删除 
2010-03-06 15:54
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
谢谢各位,帮忙看下出错在哪了?
2010-03-06 15:56
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
是修改代码那有问题吗?有谁能看出问题所在啊?谢了!
2010-03-06 17:00
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
怎么代码上也看不出错在哪了吗?
2010-03-07 09:56
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
添加图片,删除图片都没有问题,就是不能修改名称和规格,到底代码是哪有问题哦?
2010-03-07 10:10
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
程序代码:
sub ModifyNews()
dim sql,ProName,ProType,NewsTitle2,cpgg,ID
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
ProType=SafeInput(unescape(Request.Form("ProType")))
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="update jujia_Product Set cpgg='"&cpgg&"',NewsTitle2='"&NewsTitle2
sql=sql&" where ID="&ID
on error resume next
'conn.execute(sql)
Response.write(sql)'停止执行后面代码
Response.end()'停止执行后面代码
'Response.Write(escape("修改成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub
还是检查不出问题所在,不知是不是修改链接处有问题啊?
2010-03-07 10:50
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
程序代码:
sub ModifyNews()
dim sql,ProName,ProType,NewsTitle2,cpgg,ID
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
ProType=SafeInput(unescape(Request.Form("ProType")))
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="update jujia_Product Set cpgg='"&cpgg&"',NewsTitle2='"&NewsTitle2&"'"    '这样也不行啊
sql=sql&" where ID="&ID
on error resume next
'conn.execute(sql)
Response.write(sql)'停止执行后面代码
Response.end()'停止执行后面代码
'Response.Write(escape("修改成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub
这个地方有错不?真还查不出问题所在了?
程序代码:
<script language="javascript">
var reData=null;
var eZuStudio;
var ProType;
function UpdateData(IsFile)
{    

    var NewsTitle2=escape(document.all.NewsTitle2.value);
    var cpgg=escape(document.all.cpgg.value);
    ProType=escape("<%=ProType%>");
    var postInfo = "PostType=News&Actions=Modify";
    postInfo=postInfo+"&NewsTitle2="+NewsTitle2+"&cpgg="+cpgg+"&ProType="+ProType;
    postInfo=postInfo+"&ID=<%=ID%>";
    eZuStudio=new ActiveXObject("Microsoft.XMLHTTP");
    eZuSdtio.onreadystatechange=alertContents;
    eZuStudio.open("POST","PostData.asp",false);
    eZuStudio.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    eZuStudio.send(postInfo);
}
function alertContents()
{
  if(eZuStudio.readyState==4)
  {
     if(eZuStudio.status==200)
     {
           alert(unescape(eZuStudio.responseText));
           window.location.href="Admin_Pic.asp?ProType="+ProType;
     }
  }
  else
  {
     //没有接收到数据或出错处理代码
  }
}
</script>
2010-03-07 11:06
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
回复 12楼 aspic
直接构造地址栏参数,怎么做啊,我不是太懂?可以帮弄一下不?谢谢了!
程序代码:
sub UpdateProducts()
dim sql,ProName,ProType,NewsTitle2,cpgg,ID
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
ProType=SafeInput(unescape(Request.Form("ProType")))
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="update jujia_Product Set cpgg='"&cpgg&"',NewsTitle2='"&NewsTitle2&"'"
sql=sql&" where ID="&ID
on error resume next
conn.execute(sql)
'Response.write(sql)'停止执行后面代码’这是为了查sql错误而弄的。
'Response.end()'停止执行后面代码
Response.Write(escape("修改成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub
2010-03-07 13:17
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
回复 15楼 aspic
重新改了一下代码,表名没事的,主要是修改的时候,好像不能传递参数!这是完整代码!
  
程序代码:
  <% dim rs,sql,page,i,NewsTitle,cpgg,ProName,NewsTitle2
    sql="select ProAddress,ProName,ProType,ID,NewsTitle2,cpgg from jujia_Product where ProName='"&NewsType&"' order by id desc "
    Set rs = Server.CreateObject ("ADODB.Recordset")
    rs.open sql,conn,1,1
    if rs.eof then
        response.write("<tr><td colpan=""4"">暂无图片</td></tr>")
        rs.pagesize=15
    else
        page=Request.QueryString("page")
        rs.PageSize = 15
        if Not IsEmpty(page) then
            if Not IsNumeric(page) then
                page=1
            else
                Page = cint(page)
            end if  
            if Page > rs.PageCount then  Page = rs.PageCount      
            if Page <= 0 then  Page = 1
        else
            Page = 1
        end if
        rs.AbsolutePage = Page
        For i = 1 to rs.PageSize
        if rs.EOF then Exit For
    
    %>
        <td height="160" align="center" valign="middle">
            <table cellpadding="0" cellspacing="0">
      <tr>
        <td class="tdbg"><img height="100" width="126" border="0" src=<%=rs(0)%>></td>
      </tr>
      <tr><br>
            <tr><td height="20" align="center" >
       
          名称:<input name="NewsTitle2" type="text" id="Title" value="<%=rs(4)%>" size="15" maxlength="50"></td>
      </tr>
      <tr><td height="20" align="center" >
       
          规格:<input name="cpgg" type="text" id="Title" value="<%=rs(5)%>" size="15" maxlength="50"></td>
      </tr>
      <tr>
        <td height="20" align="center"> &nbsp;
          &nbsp; <input name="Submit2" onClick="if(confirm('确定删除?'))DeleteData(<%=rs(3)%>)" type="button" id="Submit" value="删除" />
          &nbsp; <input name="Submit" onClick="if(confirm('确定修改?'))UpdateData(0)" type="button" id="Submit" value="修改"><input type="hidden" name="NewsFile" value="0"><input name="IsFile" type="hidden" value="0" /></td>
      </tr>
    </table>
          </td>
         
        <%
        if i=5 or i=10  then
        response.write("</tr><tr>")
        end if
        rs.movenext
        next
        end if
        %>
        </tr>
        <tr>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;PAGE:&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_pic.asp?page=1">1</a><% for i=2 to rs.pagecount %>
        |&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_pic.asp?page=<%=i%>"><%=i%></a>
        <% next %></td>
        </tr>
</table>
</body>
</html>
<script language="javascript">
function DeleteData(ID)
{       
    var postInfo = "PostType=Products&Actions=Delete&ID="+ID;
    var eZuStudio = new ActiveXObject("Microsoft.XMLHTTP");
    eZuStudio.open("POST","PostData.asp",false);
    eZuStudio.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    eZuStudio.send(postInfo);
    alert(unescape(eZuStudio.responseText));
    window.location.reload();
}
</script>
<script language="javascript">
function UpdateData(IsFile)
{   
    var reData=null;
    var NewsTitle2=escape(document.all.NewsTitle2.value);
    var cpgg=escape(document.all.cpgg.value);
    var ProType=escape("<%=ProType%>");
    var postInfo = "PostType=Products&Actions=Update";
    postInfo=postInfo+"&NewsTitle2="+NewsTitle2+"&cpgg="+cpgg+"&ProType="+ProType;
    postInfo=postInfo+"&ID=<%=ID%>";
    var eZuStudio=new ActiveXObject("Microsoft.XMLHTTP");
    eZuSdtio.onreadystatechange=alertContents;
    eZuStudio.open("POST","PostData.asp",false);
    eZuStudio.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    eZuStudio.send(postInfo);
}
function alertContents()
{
  if(eZuStudio.readyState==4)
  {
     if(eZuStudio.status==200)
     {
           alert(unescape(eZuStudio.responseText));
            window.location.reload();
     }
  }
  else
  {
  //没有接收到数据或出错处理代码
  }
}
</script>
2010-03-07 14:22
川之鱼
Rank: 1
来 自:四川——成都
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-3-4
收藏
得分:0 
回复 16楼 川之鱼,这是PostData.asp的代码
程序代码:
'产品信息管理///////////////////////////////////////////////////////////
sub Products()
dim Actions
Actions=SafeInput(Request("Actions"))
Select case Actions
case "Delete"
call DeleteProducts()
case "Update"
call UpdateProducts()
case "Add"
call AddProducts()
end select
end sub

sub AddProducts()
dim sql,ProName,ProAddress,ProDate,NewsFile,ProType,NewsTitle2,cpgg
ProType=SafeInput(unescape(Request.Form("ProName.value")))
ProName=SafeInput(unescape(Request.Form("ProName")))
NewsFile=unescape(Request.Form("NewsFile"))
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
'NewsFile="a"
'ProDate=time()
    sql="insert into jujia_Product (ProName,ProAddress,ProType,NewsTitle2,cpgg) values "
    sql=sql&"('"&ProType&"','"&NewsFile&"','"&ProType&"','"&NewsTitle2&"','"&cpgg&"')"
    conn.execute(sql)
    Response.Write(escape("添加成功!"))
end sub

sub UpdateProducts()
dim sql,ProName,ProType,NewsTitle2,cpgg,ID
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
ProType=SafeInput(unescape(Request.Form("ProType")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="update jujia_Product Set NewsTitle2='"&NewsTitle2&"',cpgg='"&cpgg&"'"
sql=sql&" where ID="&ID
on error resume next
conn.execute(sql)
'Response.write(sql)'停止执行后面代码
'Response.end()'停止执行后面代码
Response.Write(escape("修改成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub

sub DeleteProducts()
dim sql,ID
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="delete from jujia_Product where ID="&ID
conn.execute(sql)
Response.Write(escape("删除成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub
2010-03-07 14:26
快速回复:为什么不能修改图片啊?只能删除图片?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027593 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved