public bool delete_table(clsSeat cf) { try { con.ConDatabase(); SqlCommand cmd = new SqlCommand("proc_seat_delete", con.conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); SqlParameter[] prams = { new SqlParameter("@house_seatID", SqlDbType.VarChar, 50) }; prams[0].Value = cf.id; // 添加参数 foreach (SqlParameter parameter in prams) { cmd.Parameters.Add(parameter); } cmd.ExecuteNonQuery(); con.closeCon(); return(true); } catch { con.closeCon(); return(false); } }
public string insert_table(clsSeat cf) { try { con.ConDatabase(); SqlCommand cmd = new SqlCommand("proc_seat_insert", con.conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); SqlParameter[] prams = { new SqlParameter("@house_seatID", SqlDbType.VarChar, 50), new SqlParameter("@seat_name", SqlDbType.VarChar, 50), new SqlParameter("@seat_remark", SqlDbType.VarChar, 50), new SqlParameter("@proc_info", SqlDbType.VarChar, 50,ParameterDirection.Output,true, 0, 0, string.Empty, DataRowVersion.Default, null) }; prams[0].Value = cf.id; prams[1].Value = cf.name; prams[2].Value = cf.remark; // 添加参数 foreach (SqlParameter parameter in prams) { cmd.Parameters.Add(parameter); } cmd.ExecuteNonQuery(); string strResult = cmd.Parameters["@proc_info"].Value.ToString(); con.closeCon(); return(strResult); } catch (Exception ey) { con.closeCon(); return(ey.Message.ToString()); } }