无法将类型“object”隐式转换为“System.Data.SqlClient.SqlCommand”。存在显式转换(您是否缺少演员表?)
创建用户控件时出现此错误
它在这段代码中。
protected void gvDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int Slno = Convert.ToInt32(gvDetails.DataKeys[e.RowIndex].Value.ToString());
var ProductNum = gvDetails.DataKeys[e.RowIndex].Values["ProductNumber"].ToString();
TextBox txtShortDesc = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("ShortDesc");
SqlCommand cmd= SqlHelper.ExecuteScalar(GlobalSettings.DbDSN, CommandType.Text,"UPDATE sydShortDesc set ShortDesc='"+ txtShortDesc.Text+ " ' WHERE ProductNumber='"+ ProductNum +"' ");
cmd.ExecuteNonQuery();
lblresult.ForeColor = Color.Green;
lblresult.Text = username + " Details Updated successfully";
gvDetails.EditIndex = -1;
BindEmployeeDetails();
}