1
Fork 0

started writing function for viewing records

This commit is contained in:
Jake Howard 2015-01-01 16:45:23 +00:00
parent 2cc89791a2
commit 2d2c473c21
3 changed files with 21 additions and 0 deletions

View File

@ -16,5 +16,10 @@ namespace Saviour_Backup_System
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
dataGridView.DataSource = databaseTools.getAllDriveBackups();
/*this will need editing to make it more people readable, and format dates etc.*/
}
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="styleManager.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -150,5 +150,18 @@ namespace Saviour_Backup_System
conn.Close();
return hash;
}
public static DataTable getAllDriveBackups()
{
DataTable table = new DataTable();
conn.Open();
cmd.CommandText =
"SELECT Recordset.Name as Backup_Name, Recordset.Creation_Date, Recordset.Backup_Location, Drive.Name, Drive.Capacity FROM Recordset, Drive"; //write this out in compactview frst;
using (SqlCeDataAdapter adapter = new SqlCeDataAdapter(cmd.CommandText, conn)) {
adapter.Fill(table);
conn.Close();
return table;
}
}
}
}