public void updateDatabaseSystemProfile(DatabaseConnection database, XMLSystemProfile profile) { if(database == null) throw new NullReferenceException("AppLoader: Database connection is null"); //connection not open so open it if(database.IsOpenConnection() == false) dbConnect.Connect(dbConnectString); StringBuilder update = new StringBuilder(); update.Append("INSERT INTO SystemProfile "); update.Append("(Processor_Manufacturer,Processor_Name ,Processor_Max_ClockSpeed, Processor_ID ,Processor_Revision ,OpSystem_Caption ,"+ "OpSystem_ServicePack_MajorVersion ,OpSystem_ServicePack_MinorVersion ,OpSystem_Install_Date ,OpSystem_Version ,"+ "OpSystem_Free_Physical_Memory , System_Caption ,System_Description ,System_Manufacturer ,System_Model ,System_Total_Physical_Memory)"); update.Append("VALUES "); update.Append("("); update.Append("'"+profile.ProcessorManufacturer+"',"); update.Append("'" + profile.ProcessorName + "',"); update.Append("'" + profile.ProcessorMaxClockSpeed + "',"); update.Append("'" + profile.ProcessorID + "',"); update.Append("'" + profile.ProcessorRevision + "',"); update.Append("'" + profile.OpSystemCaption + "',"); update.Append("'" + profile.OpSystemServicePackMajorVersion + "',"); update.Append("'" + profile.OpSystemServicePackMinorVersion + "',"); update.Append("'" + profile.OpSystemInstallDate + "',"); update.Append("'" + profile.OpSystemVersion + "',"); update.Append("'" + profile.OpSystemFreePhysicalMemory+ "',"); update.Append("'" + profile.SystemCaption+ "',"); update.Append("'" + profile.SystemDescription + "',"); update.Append("'" + profile.SystemManufacturer + "',"); update.Append("'" + profile.SystemModel + "',"); update.Append("'" + profile.SystemTotalPhysicalMemory + "'"); update.Append(");"); dbConnect.ExecuteUpdate(update.ToString()); }
public XMLSystemProfile loadSystemProfileFromDatabase(DatabaseConnection database) { if (database == null) throw new NullReferenceException("AppLoader: Database connection is null"); //connection not open so open it if (database.IsOpenConnection() == false) dbConnect.Connect(dbConnectString); XMLSystemProfile profile = new XMLSystemProfile(); string query = "SELECT * FROM SystemProfile WHERE 1"; SQLiteDataReader reader = dbConnect.ExecuteQuery(query); while (reader.Read()) { profile.ProcessorManufacturer = (string)reader["Processor_Manufacturer"]; profile.ProcessorName = (string)reader["Processor_Name"]; //profile.ProcessorMaxClockSpeed = (UInt32)reader["Processor_Max_ClockSpeed"]; profile.ProcessorID = (string)reader["Processor_ID"]; //profile.ProcessorRevision = (UInt16)reader["Processor_Revision"]; profile.OpSystemCaption = (string)reader["OpSystem_Caption"]; //profile.OpSystemServicePackMajorVersion = (UInt16)reader["OpSystem_ServicePack_MajorVersion"]; //profile.OpSystemServicePackMinorVersion = (UInt16)reader["OpSystem_ServicePack_MinorVersion"]; profile.OpSystemInstallDate = (string)reader["OpSystem_Install_Date"]; profile.OpSystemVersion = (string)reader["OpSystem_Version"]; //profile.OpSystemFreePhysicalMemory = (UInt64)reader["OpSystem_Free_Physical_Memory"]; profile.SystemCaption = (string)reader["System_Caption"]; profile.SystemDescription = (string)reader["System_Description"]; profile.SystemManufacturer = (string)reader["System_Manufacturer"]; profile.SystemModel = (string)reader["System_Model"]; //profile.SystemTotalPhysicalMemory = (UInt64)reader["System_Total_Physical_Memory"]; } return profile; }