internal int Editguigetypevalue(B2b_com_pro_Specitypevalue m) { string sql = "select id from b2b_com_pro_Specitypevalue where proid=" + m.proid + " and typeid='" + m.typeid + "' and val_name='" + m.val_name + "'"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); var valid = 0; using (var reader = cmd.ExecuteReader()) { if (reader.Read()) { valid = reader.GetValue <int>("id"); } } #region 编辑 if (valid > 0) { string sql1 = "update b2b_com_pro_Specitypevalue set val_name='" + m.val_name + "',isonline=1 where id=" + valid; var cmd1 = sqlHelper.PrepareTextSqlCommand(sql1); cmd1.ExecuteNonQuery(); return(valid); } #endregion #region 添加 else { string sql2 = "INSERT INTO [b2b_com_pro_Specitypevalue] ([comid] ,typeid ,[val_name] ,[proid] ,isonline) VALUES (" + m.comid + "," + m.typeid + ",'" + m.val_name + "'," + m.proid + ",1);select @@identity;"; var cmd2 = sqlHelper.PrepareTextSqlCommand(sql2); object o = cmd2.ExecuteScalar(); return(int.Parse(o.ToString())); } #endregion }
public int Editguigetypevalue(B2b_com_pro_Specitypevalue m) { using (var helper = new SqlHelper()) { int result = new Internalb2b_com_pro_Specitypevalue(helper).Editguigetypevalue(m); return(result); } }