I have a database containing one table with several columns, first of which is the auto generated ID.
I've created a dataset (.xsd) from it, and I'm trying to use it for reading, writing into and updating the database.
So far, reading works fine, all I have to do is:
var reservations = new DataSet1.reservationsDataTable();
var ta = new DataSet1TableAdapters.reservationsTableAdapter();
ta.Fill(reservations);
for (int i = 0; i < reservations.Rows.Count; i++)
{
// read whatever I need here...
}
However, when I try updating my database with these lines, it fails and it doesn't create a new record in my database:
var ta = new DataSet1TableAdapters.reservationsTableAdapter();
ta.Insert(LastName,Arrival,Departure);
Of course, I previously initialize variables LastName, Arrival and Departure with the user input. I also tried creating a new Insert query, but same thing happens, even worse - it wants a string type of input for a DateTime (Arrival, Departure).
I'm not sure what I'm doing wrong...
P.S - I also need to UPDATE my database using datasets later, so I really need to figure this out.
Thank you!