大家帮我看看这到底是怎么回事,怎么老是提示'必须输入参数@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) ";