我有一个更新数据库表的网络表单,提交表单后出现错误“输入字符串格式不正确”
节点详细信息.cs
protected void SqlDataSource_Updating(object sender, SqlDataSourceCommandEventArgs e)
{
DropDownList ddl = (DropDownList)(DetailsView1.Rows[0].FindControl("DropDownList4"));
DataRowView dr = (DataRowView)DetailsView1.DataItem;
e.Command.Parameters["@parent_id"].Value = ddl.SelectedValue;
}
nodeDetails.aspx 中的一些代码
UpdateCommand="UPDATE [node] SET [title] = @title, [parent_id] = @parent_id, [oid] = @oid, [display] = @display, [linkById] = @linkById, [showContent] = @showContent, [customLinks] = @customLinks, [contentType] = @contentType WHERE [id] = @id"
<UpdateParameters>
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="parent_id" Type="Int32" />
<asp:Parameter Name="oid" Type="Int32" />
<asp:Parameter Name="display" Type="Byte" />
<asp:Parameter Name="linkById" Type="Byte" />
<asp:Parameter Name="showContent" Type="Byte" />
<asp:Parameter Name="customLinks" Type="String" />
<asp:Parameter Name="contentType" Type="String" />
<asp:Parameter Name="id" Type="Int32" />
</UpdateParameters>
该错误将由 e.Command.Parameters["@parent_id"].Value = ddl.SelectedValue;
有谁知道是什么问题?