Reputation: 19
I'm making a application coffee shop management in C#.
I have tables like Bill, BillInfo, Food, FoodCategory, FoodTable and I have 10 FoodTables.
When I click one of the tables then an error occurs
Column 'DateCheckIn' does not belong to table
My code:
//my data
insert Bill(DateCheckIn, DateCheckOut, idTable, status)
values (GETDATE(), NULL, 1, 0);
insert Bill(DateCheckIn, DateCheckOut, idTable, status)
values (GETDATE(), NULL, 2, 0);
insert Bill(DateCheckIn, DateCheckOut, idTable, status)
values (GETDATE(), GETDATE(), 2, 1);
//my code
public Bill(DataRow row)
{
this.ID = (int)row["id"];
this.DateCheckIn = (DateTime?)row["DateCheckIn"];
var dateCheckOutTemp = row["DateCheckOut"];
if(dateCheckOutTemp.ToString() != "")
this.DateCheckOut = (DateTime?)dateCheckOutTemp;
this.Status = (int)row["status"];
}
Upvotes: 1
Views: 762
Reputation: 11
you have to add the required column to your Table.
Alter table <TableName>
add <columnName> <columnType>
Upvotes: 1