当前位置: 代码迷 >> ASP.NET >> 大家帮我看看这到底是如何回事,如何老是提示'必须输入参数@title',可是已经有了呀
  详细解决方案

大家帮我看看这到底是如何回事,如何老是提示'必须输入参数@title',可是已经有了呀

热度:864   发布时间:2013-02-26 00:00:00.0
大家帮我看看这到底是怎么回事,怎么老是提示'必须输入参数@title',可是已经有了呀
SqlDataSource   :
<asp:SqlDataSource   ID= "SqlDataSource1 "   runat= "server "   DataSourceMode=DataSet     ProviderName= "System.Data.SqlClient "   ConnectionString= " <%$   ConnectionStrings:wwwConnectionString   %> "
                        SelectCommand= "SELECT   *   FROM   [Student]   ORDER   BY   [id]   desc "                            
                            DeleteCommand= "delete   from   Student   where   id=@id "                        
                        >
                        <DeleteParameters>
                              <asp:Parameter   Name= "id "     Type=Int32/>
                        </DeleteParameters>
                </asp:SqlDataSource>
gridview1:
  DataSourceID= "SqlDataSource1 ",DataKeyNames= "id "
<FooterTemplate>
                                                <asp:Button   ID= "Button3 "   runat= "server "   Text= "添加 "   CommandName= "add "   CausesValidation= "False "   OnClick= "add_Click "/>
                                        </FooterTemplate>
protected   void   add_Click(object   sender,   EventArgs   e)
        {
                string   dtime   =   ((TextBox)GridView1.FooterRow.FindControl( "new_BirthDay ")).Text;
                string   title   =   ((TextBox)GridView1.FooterRow.FindControl( "new_title ")).Text;
                int   gender=((RadioButtonList)GridView1.FooterRow.FindControl( "new_gender ")).SelectedValue   ==   "男 "?1:0;    
              string   clsname   =   ((DropDownList)GridView1.FooterRow.FindControl( "new_classname ")).SelectedValue;
                FileUpload   fil   =   (FileUpload)GridView1.FooterRow.FindControl( "addphoto ");
                string   filename   =   " ";
                filename   =   Guid.NewGuid().ToString( "D ")   +   System.IO.Path.GetExtension(fil.FileName);
                fil.SaveAs(Server.MapPath( "~/images/Upload/ ")   +   filename);
                string   sql   =   "insert   into   Student(Title,BirthDay,Gender,PhotoPath,ClassName)values(@Title,@BirthDay,@Gender,@PhotoPath,@ClassName) ";
  相关解决方案