Cleaned up the code in the new modify record form and changed the return value from string to integer in the date ID get method. Fixed a crash bug in the new add record form and fixed the row number bug in both forms.

This commit is contained in:
2017-01-20 18:30:36 -06:00
parent 84f43538d1
commit 9fa2e3c44a
9 changed files with 253 additions and 195 deletions
+10 -3
View File
@@ -70,9 +70,16 @@ namespace AdvertsingProfitControl
return dateId;
}
public string RetrieveDateIdByDateString(string dateString, string connectionString)
/// <summary>
/// Returns the date ID of the date string that is passed.
/// Preferred format is short date (1/20/2017).
/// </summary>
/// <param name="dateString">The date to be looked up.</param>
/// <param name="connectionString">The connection to the database.</param>
/// <returns>The date ID or zero (0) on fail.</returns>
public int RetrieveDateIdByDateString(string dateString, string connectionString)
{
var dateId = "0";
var dateId = 0;
var oleDbCommand = new OleDbCommand()
{
CommandText = "SELECT WeekEnding.ID FROM WeekEnding WHERE WeekEnding.EndOfWeekDate = ?"
@@ -90,7 +97,7 @@ namespace AdvertsingProfitControl
{
while(reader != null && reader.Read())
{
dateId = reader[0].ToString();
dateId = int.Parse(reader[0].ToString());
}
}
}