public QQPACK(int id) { // NOTE: If this reference doesn't exist then add SqlService.cs from the template directory to your solution. SqlService sql = new SqlService(); sql.AddParameter("@ID", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader("SELECT * FROM QQPACK WHERE ID = @ID"); if (reader.Read()) { this.LoadFromReader(reader); reader.Close(); } else { if (!reader.IsClosed) reader.Close(); throw new ApplicationException("QQPACK does not exist."); } }
public void Create() { SqlService sql = new SqlService(); StringBuilder queryParameters = new StringBuilder(); //sql.AddParameter("@ID", SqlDbType.Int, Id); //queryParameters.Append("@ID"); sql.AddParameter("@QQ", SqlDbType.VarChar, QQ); queryParameters.Append("@QQ"); sql.AddParameter("@PASS", SqlDbType.VarChar, PASS); queryParameters.Append(", @PASS"); sql.AddParameter("@MD5PASS", SqlDbType.VarChar, MD5PASS); queryParameters.Append(", @MD5PASS"); sql.AddParameter("@SP0X0825_BYTES", SqlDbType.VarChar, SP0X0825_BYTES); queryParameters.Append(", @SP0X0825_BYTES"); sql.AddParameter("@SP0X0825", SqlDbType.VarChar, SP0X0825); queryParameters.Append(", @SP0X0825"); sql.AddParameter("@RP0X0825_BYTES", SqlDbType.VarChar, RP0X0825_BYTES); queryParameters.Append(", @RP0X0825_BYTES"); sql.AddParameter("@RP0X0825", SqlDbType.VarChar, RP0X0825); queryParameters.Append(", @RP0X0825"); sql.AddParameter("@SP0X0826_BYTES", SqlDbType.VarChar, SP0X0826_BYTES); queryParameters.Append(", @SP0X0826_BYTES"); sql.AddParameter("@SP0X0826", SqlDbType.VarChar, SP0X0826); queryParameters.Append(", @SP0X0826"); sql.AddParameter("@VERIFYKEY", SqlDbType.VarChar, VERIFYKEY); queryParameters.Append(", @VERIFYKEY"); sql.AddParameter("@RP0X0826_BYTES", SqlDbType.VarChar, RP0X0826_BYTES); queryParameters.Append(", @RP0X0826_BYTES"); sql.AddParameter("@RP0X0826", SqlDbType.VarChar, RP0X0826); queryParameters.Append(", @RP0X0826"); sql.AddParameter("@SP0X0828_BYTES", SqlDbType.VarChar, SP0X0828_BYTES); queryParameters.Append(", @SP0X0828_BYTES"); sql.AddParameter("@SP0X0828", SqlDbType.VarChar, SP0X0828); queryParameters.Append(", @SP0X0828"); sql.AddParameter("@RP0X0828_BYTES", SqlDbType.VarChar, RP0X0828_BYTES); queryParameters.Append(", @RP0X0828_BYTES"); sql.AddParameter("@RP0X0828", SqlDbType.VarChar, RP0X0828); queryParameters.Append(", @RP0X0828"); string query = String.Format("Insert Into QQPACK ({0}) Values ({1})", queryParameters.ToString().Replace("@", ""), queryParameters.ToString()); SqlDataReader reader = sql.ExecuteSqlReader(query); }
public void Update() { SqlService sql = new SqlService(); StringBuilder queryParameters = new StringBuilder(); sql.AddParameter("@ID", SqlDbType.Int, Id); queryParameters.Append("ID = @ID"); sql.AddParameter("@QQ", SqlDbType.VarChar, QQ); queryParameters.Append(", QQ = @QQ"); sql.AddParameter("@PASS", SqlDbType.VarChar, PASS); queryParameters.Append(", PASS = @PASS"); sql.AddParameter("@MD5PASS", SqlDbType.VarChar, MD5PASS); queryParameters.Append(", MD5PASS = @MD5PASS"); sql.AddParameter("@SP0X0825_BYTES", SqlDbType.VarChar, SP0X0825_BYTES); queryParameters.Append(", SP0X0825_BYTES = @SP0X0825_BYTES"); sql.AddParameter("@SP0X0825", SqlDbType.VarChar, SP0X0825); queryParameters.Append(", SP0X0825 = @SP0X0825"); sql.AddParameter("@RP0X0825_BYTES", SqlDbType.VarChar, RP0X0825_BYTES); queryParameters.Append(", RP0X0825_BYTES = @RP0X0825_BYTES"); sql.AddParameter("@RP0X0825", SqlDbType.VarChar, RP0X0825); queryParameters.Append(", RP0X0825 = @RP0X0825"); sql.AddParameter("@SP0X0826_BYTES", SqlDbType.VarChar, SP0X0826_BYTES); queryParameters.Append(", SP0X0826_BYTES = @SP0X0826_BYTES"); sql.AddParameter("@SP0X0826", SqlDbType.VarChar, SP0X0826); queryParameters.Append(", SP0X0826 = @SP0X0826"); sql.AddParameter("@VERIFYKEY", SqlDbType.VarChar, VERIFYKEY); queryParameters.Append(", VERIFYKEY = @VERIFYKEY"); sql.AddParameter("@RP0X0826_BYTES", SqlDbType.VarChar, RP0X0826_BYTES); queryParameters.Append(", RP0X0826_BYTES = @RP0X0826_BYTES"); sql.AddParameter("@RP0X0826", SqlDbType.VarChar, RP0X0826); queryParameters.Append(", RP0X0826 = @RP0X0826"); sql.AddParameter("@SP0X0828_BYTES", SqlDbType.VarChar, SP0X0828_BYTES); queryParameters.Append(", SP0X0828_BYTES = @SP0X0828_BYTES"); sql.AddParameter("@SP0X0828", SqlDbType.VarChar, SP0X0828); queryParameters.Append(", SP0X0828 = @SP0X0828"); sql.AddParameter("@RP0X0828_BYTES", SqlDbType.VarChar, RP0X0828_BYTES); queryParameters.Append(", RP0X0828_BYTES = @RP0X0828_BYTES"); sql.AddParameter("@RP0X0828", SqlDbType.VarChar, RP0X0828); queryParameters.Append(", RP0X0828 = @RP0X0828"); string query = String.Format("Update QQPACK Set {0} Where ID = @ID", queryParameters.ToString()); SqlDataReader reader = sql.ExecuteSqlReader(query); }
public QQPACK(int id) { // NOTE: If this reference doesn't exist then add SqlService.cs from the template directory to your solution. SqlService sql = new SqlService(); sql.AddParameter("@ID", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader("SELECT * FROM QQPACK WHERE ID = @ID"); if (reader.Read()) { this.LoadFromReader(reader); reader.Close(); } else { if (!reader.IsClosed) { reader.Close(); } throw new ApplicationException("QQPACK does not exist."); } }
public static void Delete(int id) { SqlService sql = new SqlService(); sql.AddParameter("@ID", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader("Delete QQPACK Where ID = @ID"); }