标题:ajaxpro无法保存数据,那位高手告诉我原因
取消只看楼主
dybeikehm
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-8-7
结帖率:0
 问题点数:0 回复次数:0 
ajaxpro无法保存数据,那位高手告诉我原因
源代码如下,前台代码
<script language="javascript" type="text/javascript" >
  function showtab(vid,sid)
  {
    if(sid=='0')
    {
     document.getElementById(vid).style.display="";
     return;
    }
     
  }
  function showtab1(vid,sid)
  {
    if(sid=='1')
    {
     document.getElementById(vid).style.display="none";
     return;
    }
     
  }
   function deltab1(vid,sid)
  {
    if(sid=='1')
    {
   
     gerenkongjian_index.delwc(vid);
      return;
   
    }
     
  }
   function deltab2(vid,sid)
  {
    if(sid=='1')
    {
     gerenkongjian_index.delnc(vid);
      return;
   
    }
     
  }
   function addtab1(vid,sid)
  {
    if(sid=='1')
    {
    var p1=document.getElementById("txtcontent");
    var p2=document.getElementById("wcwb"+vid);
    p1.value=p2.value;
     gerenkongjian_index.addwc(vid);
     
   
    }
     
  }
   function addtab2(vid,sid)
  {
    var p1=document.getElementById("txtcontent");
    var p2=document.getElementById("ncwb"+vid);
    p1.value=p2.value;
   gerenkongjian_index.addnc(vid,sid);
  
     
  }
  
</script>后台
public void addwc(string lyid2)
    {
        string wc = "wcwb" + lyid2;
        string kk = Request.Form["txtcontent"];
        
        string addwcstr = "insert into kjlyhf(lyid,content,addtime,sx,userid) values("+Convert.ToInt32(lyid2)+",'"+kk+"','"+System.DateTime.Now.ToShortDateString()+"','"+lyid2+"',"+Convert.ToInt32(Session["admin_userid"].ToString())+")";
        SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        conn.Open();
        SqlCommand delwccmd = new SqlCommand(addwcstr, conn);
        delwccmd.ExecuteNonQuery();
        conn.Close();
        lywc();
    }
    [AjaxPro.AjaxMethod]
    public void addnc(string lyid3,string lyid4)
    {
        string wc = "ncwb" + lyid3;
        string kk = Request.Form["txtcontent"];
      
        string addwcstr = "insert into kjlyhf(lyid,content,addtime,sx,userid) values(" + Convert.ToInt32(lyid4) + ",'" + kk + "','" + System.DateTime.Now.ToShortDateString() + "','" +lyid3+lyid4 + "'," + Convert.ToInt32(Session["admin_userid"].ToString()) + ")";
        SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        conn.Open();
        SqlCommand delwccmd = new SqlCommand(addwcstr, conn);
        delwccmd.ExecuteNonQuery();
        conn.Close();
        lywc();
    }
搜索更多相关主题的帖子: ajaxpro 数据 保存 
2010-08-07 16:23



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-315056-1-1.html




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

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