日期:2014-05-19  浏览次数:20442 次

常规方式转存储过程的问题!
我做的插入数据的代码,以前使用的常规方式,现改为使用存储过程,不知哪儿有问题!请大家帮忙看看!        
protected   void   BtnLW_Click(object   sender,   EventArgs   e)
        {
               
                        string   Lw_type   =   this.DropDownType.SelectedValue.ToString();
                        string   Lw_Title   =   this.TxtTitle.Text.ToString();
                        string   Lw_Content   =   this.TxtContent.Text.ToString();
                        string   Lw_Name   =   this.TxtName.Text.ToString();
                        string   Lw_Email   =   this.TxtEmail.Text.ToString();
                        string   Lw_Phone   =   this.TxtPhone.Text.ToString();
                        string   Lw_Address   =   this.TxtAddress.Text.ToString();
                        string   Lw_zip   =   this.TxtZipCode.Text.ToString();

                        string   newsid   =   Request.QueryString[ "id "];
                        SqlConnection   conn   =   new   SqlConnection();
                        ConnectionStringSettings   s   =   ConfigurationManager.ConnectionStrings[ "Wlw_SqlDataConnectionString1 "];
                        String   connString   =   s.ConnectionString;
                        conn.ConnectionString   =   s.ConnectionString;
                   
                        try
                        {
  //用常规方式,可以正常运行:                              
                             
                                //string   sql   =   string.Format( "insert   into   LeaveWord(lwType,lwTitle,lwContent,lwName,lwEmail,lwPhone,lwAddress,lwZip)values( '{0} ', '{1} ', '{2} ', '{3} ', '{4} ', '{5} ', '{6} ', '{7} ') ",   Lw_type,   Lw_Title,   Lw_Content,   Lw_Name,   Lw_Email,   Lw_Phone,   Lw_Address,   Lw_zip);

//用存储过程,总不能插入数据,提示“数据更新失败”:
                                string   sql   =   stri