Heiko Posted August 19, 2003 Posted August 19, 2003 I am having problem with this fragment of code: Public Sub SaveDatabaseValue(ByRef myRow As System.Data.DataRow, ByVal columnName As String) Implements IExtendedControl.SaveDatabaseValue Dim dt As DateTime ' ... snip dt = CType(txtDate.Text & " " & txtTime.Text, DateTime) If mIsEstimatedValue Then dt.AddMilliseconds(5000) End If myRow(columnName) = dt End Sub because my row will not contain the milliseconds' value. All I get is seconds. (datarow is a row from a table from a strongly typed dataset). <xs:element name="PZE_IstDatumUhrzeitVon" codegen:nullValue="9999-01-01T00:00:00" type="xs:dateTime" minOccurs="0" /> This is generated. Any ideas how I can convince my dataset to accept milliseconds? Quote .nerd
*Experts* Nerseus Posted August 19, 2003 *Experts* Posted August 19, 2003 A DateTime stores the milliseconds and so does SQL Server. My guess is that the line that first sets dt doesn't store milliseconds (just the date and time). Later you add 5000 milliseconds, which is just 5 seconds. Your milliseconds should still be 0, as expected. Try your test setting dt to DateTime.Now to see if the code works. Make sure that the value DateTime.Now HAS milliseconds as well as you may get lucky/unlucky and hit it just right :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Heiko Posted August 20, 2003 Author Posted August 20, 2003 Thanks Nerseus, Yep. You pointed out one embarrassing mistake ... 5000 ms is 5 seconds. Bummer :) I changed it to 500 and still ist doesn't work. (just for my reputation, I discovered that before reading your reply :) ) When using the dataset's .toXML method, I can see the seconds and milliseconds (or ticks to be precise) in the XML file. Surprisingly, this does work with seconds (txtTime.Text is hh:mm). In short: When I look at the datarow.item (.toString) I never see the milliseconds. All I see is seconds. When I look at the XML file with the datarow in it, I see the ticks all set to zero. Quote .nerd
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.