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();
}