public static float GetDecimal(string procName, string ID) { SqlDataReader reader; Database database = new Database(); SqlParameter[] prams = { database.MakeInParam("@ID", SqlDbType.VarChar, 100, ID) }; database.RunProc(procName, prams, out reader); ArrayList list = new ArrayList(); while (reader.Read()) { if (!reader.IsDBNull(0)) { return(reader.GetFloat(0)); } } return(0); }
public int Delete_User(UserPublic p) { Database cn = new Database(); SqlParameter[] prams = { cn.MakeInParam("@Id", SqlDbType.Int, 4, p.Id) }; cn.RunProc("User_Delete", prams); cn.Dispose(); try { return((int)prams[0].Value); } catch (Exception) { return(1); } finally { cn.Close(); cn.Dispose(); } }
public static ArrayList GetIntANDString(string procName, int ID, string Name) { SqlDataReader reader; SqlParameter[] parameterArray; ArrayList list; object[] objArray; Database database = new Database(); if (ID != -1) { parameterArray = new SqlParameter[] { database.MakeInParam("@ID", SqlDbType.Int, 4, ID) }; database.RunProc(procName, parameterArray, out reader); list = new ArrayList(); while (reader.Read()) { objArray = new object[2]; if (!reader.IsDBNull(0)) { objArray[0] = reader.GetString(0); } if (!reader.IsDBNull(1)) { objArray[1] = reader.GetString(1); } list.Add(objArray); } return(list); } if (!Name.Equals("")) { parameterArray = new SqlParameter[] { database.MakeInParam("@Name", SqlDbType.VarChar, 10, Name) }; database.RunProc(procName, parameterArray, out reader); list = new ArrayList(); while (reader.Read()) { objArray = new object[2]; if (!reader.IsDBNull(0)) { objArray[0] = reader.GetString(0); } if (!reader.IsDBNull(1)) { objArray[1] = reader.GetString(1); } list.Add(objArray); } return(list); } database.RunProc(procName, out reader); list = new ArrayList(); while (reader.Read()) { objArray = new object[2]; if (!reader.IsDBNull(0)) { objArray[0] = reader.GetInt32(0); } if (!reader.IsDBNull(1)) { objArray[1] = reader.GetString(1); } list.Add(objArray); } return(list); }