public int UpdateColumnInfo(string dbName, string tbName, string colName, string value,string hasminor_id) { DbName = dbName; using (SqlConnection conn = new SqlConnection(ConnectionString)) { if (conn.State == ConnectionState.Closed) conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = hasminor_id == "True" ? "sp_updateextendedproperty" : "sp_addextendedproperty"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar) { Value = "MS_Description" }); cmd.Parameters.Add(new SqlParameter("@value", SqlDbType.NVarChar) { Value = value }); cmd.Parameters.Add(new SqlParameter("@level0type", SqlDbType.NVarChar) { Value = "SCHEMA" }); cmd.Parameters.Add(new SqlParameter("@level0name", SqlDbType.NVarChar) { Value = "dbo" }); cmd.Parameters.Add(new SqlParameter("@level1type", SqlDbType.NVarChar) { Value = "TABLE" }); cmd.Parameters.Add(new SqlParameter("@level1name", SqlDbType.NVarChar) { Value = tbName }); cmd.Parameters.Add(new SqlParameter("@level2type", SqlDbType.NVarChar) { Value = "COLUMN" }); cmd.Parameters.Add(new SqlParameter("@level2name", SqlDbType.NVarChar) { Value = colName }); try { return cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } } } }