S
Stephanie Stowe
I have a column in which I enter a time. The NumberFormat is short time. So
I can enter 8:00 am. Lovely. This grid is bound to a dataset. The underlying
data in the dataset is a SQL Server datetime. When I am entering data I
enter JUST the time. In the AfterUpdate event of the grid, I update the data
adapter:
da.Update(ds);
(note C#).
The date that gets stored to SQL is the current date. No wonder. I have
another column in the grid which contains the date that I want to save. (The
user enters the date in one column and the time in the other. It makes
sense. Really.)
My question is, before updating the data adapter, do I attempt to edit the
value in the data set? The grid column value to which the dataset is bound?
I am new to both true db grid, ado.net and windows forms (oh joy).
I cannot tell what the type of the value in the column is.
tdbgTime.Columns[2].Value LOOKS like a DateTime.
When I ? in the Command Window, I see
? tdbgTime.Columns[2].Value
{10/11/2004}
[System.DateTime]: {10/11/2004}
When I do a Console.WriteLine(tbbgTime.Columns[2].Value) I see
10/11/2004 8:00:00 AM
I was going to make a DateTime variable to store the value
DateTime t = new DateTime();
t = tdbgTime.Columns[2].Value;
But on the second line, I see a build error "Cannot implicitly convert type
'object' to 'System.DateTime'
But it looks to me like it IS a date time. I have found no cast that will
work since it does not seem that the compile can tell what the value's type
is.
Can anyone knock me upside the head since I am clearly not seeing something
fairly obvious. (I think)
THANKS!
I can enter 8:00 am. Lovely. This grid is bound to a dataset. The underlying
data in the dataset is a SQL Server datetime. When I am entering data I
enter JUST the time. In the AfterUpdate event of the grid, I update the data
adapter:
da.Update(ds);
(note C#).
The date that gets stored to SQL is the current date. No wonder. I have
another column in the grid which contains the date that I want to save. (The
user enters the date in one column and the time in the other. It makes
sense. Really.)
My question is, before updating the data adapter, do I attempt to edit the
value in the data set? The grid column value to which the dataset is bound?
I am new to both true db grid, ado.net and windows forms (oh joy).
I cannot tell what the type of the value in the column is.
tdbgTime.Columns[2].Value LOOKS like a DateTime.
When I ? in the Command Window, I see
? tdbgTime.Columns[2].Value
{10/11/2004}
[System.DateTime]: {10/11/2004}
When I do a Console.WriteLine(tbbgTime.Columns[2].Value) I see
10/11/2004 8:00:00 AM
I was going to make a DateTime variable to store the value
DateTime t = new DateTime();
t = tdbgTime.Columns[2].Value;
But on the second line, I see a build error "Cannot implicitly convert type
'object' to 'System.DateTime'
But it looks to me like it IS a date time. I have found no cast that will
work since it does not seem that the compile can tell what the value's type
is.
Can anyone knock me upside the head since I am clearly not seeing something
fairly obvious. (I think)
THANKS!