我使用中继器而不是网格视图。在按钮中我完成了代码,但是当我调试时它显示错误....我正在尝试批准文档但发生错误
好的,现在我发布了整个代码,,
protected void Button1_Click(object sender, EventArgs e)
{
string connStr = ConfigurationManager.ConnectionStrings["mydms"].ConnectionString;
SqlConnection mySQLconnection = new SqlConnection(connStr);
if (mySQLconnection.State == ConnectionState.Closed)
{
mySQLconnection.Open();
for (int i = 0; i < Repeater2.Items.Count; i++)
{
DropDownList DropDownListcontrol =
((DropDownList)Repeater2.Items[i].FindControl("DropDownList4"));
Label DocId = ((Label)Repeater2.Items[i].FindControl("DocId"));
SqlCommand cmd = new SqlCommand("approveddd", mySQLconnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@DocID", SqlDbType.Int).Value =
Convert.ToInt32((DocId.Text));
cmd.Parameters.Add("@ApproveID", SqlDbType.Int).Value =
Convert.ToInt32(DropDownListcontrol.SelectedValue);
cmd.Parameters.Add("@ApproveBy", SqlDbType.VarChar, 50).Value =
(Session["Login2"]);
cmd.ExecuteNonQuery();
//UPDATE APPPROVEID IN DOCUMENTINFO TABLE
DMSLIB.Doc myDoc = new DMSLIB.Doc();
myDoc.MarkDocAs(Convert.ToInt16(DocId.Text),
Convert.ToInt32(DropDownListcontrol.SelectedValue));
}
}
else
{
apfi.Text = "Error";
}
if (mySQLconnection.State == ConnectionState.Open)
{
mySQLconnection.Close();
}
}
这一行的错误
cmd.Parameters.Add("@DocID", SqlDbType.Int).Value =
Convert.ToInt32((DocId.Text));
任何想法?
错误:输入字符串的格式不正确