Hello there,
I am having trouble with my C# datagrid. Im working with sql. I have four columns in my datagrid: firstname, lastname, membership, date. So heres the design behind my app. Employee scans a card, hits update. Info pertaining to that member gets pulled from the sql database, then populated into my datagrid. Date gets added after. I did it this way because its the only way I know how to add it. Once that same members card gets scanned again, I am wanting the app to check the last time the card was scanned, and then display a message based on that. Heres my problem:
I NEED to add the date under the "Date" column, but am having a little trouble. Heres my code:
private void insertDate()
{
da.UpdateCommand = new SqlCommand("UPDATE WaynokaLogger SET Date = @Date", cs);
da.UpdateCommand.Parameters.AddWithValue("@Date", SqlDbType.Date).Value = dt;
da.UpdateCommand.ExecuteNonQuery();
}
Now the above code works, only problem is that it updates all rows date values! Can someone please help me out? Major cred will be awarded. This is my first time integrating Sql with C#. And might I add its kind of a b!tch.