It seems that you wrote code for the Roommate project by trying to follow the pattern created by the code that was given to you. This is usually a good strategy, HOWEVER, the code you wrote does not work. In fact, it would not compile. This suggests that you didn't test it. You must test your code as you go. You should write as little code as possible before testing it.
The Room
property of a Roommate
is not a string. This code doesn't look like it would compile. You should fix errors like this before moving onto writing more code.
|
Roommate Gus = new Roommate |
|
{ |
|
Firstname = "Gus", |
|
Lastname = "Herring", |
|
RentPortion = 500, |
|
MovedInDate = 090920, |
|
Room = "GuestRoom" |
|
|
|
}; |
This is invalid SQL
|
cmd.CommandText = "SELECT Id Firstname Lastname RentPortion MovedInDate Room FROM Roommate"; |
The Room
property is not a string
|
string RoomValueValue = reader.GetString(RoomValueColumnPosition); |
This is invalid SQL
|
cmd.CommandText = "SELECT Firstname Lastname RentPortion MovedInDate Room FROM Roommate WHERE Id = @id"; |
The Room
property is not a string
|
Room = reader.GetString(reader.GetOrdinal("LastName")), |