Re: How to insert a DBTIMESTAMP type of data using OLE DB



Thanks for the info but setting fraction to 0 doesn't help. I still got the
same error.

"Erland Sommarskog" wrote:

> Clayton Kao (Clayton Kao@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
> > When I use the following code to insert a new record into the table, I got
> > error -2147467259 (0x80004005).
> > CdboScanners dboScanners;
> > if (dboScanners.Open() == S_OK)
> > {
> > strcpy(dboScanners.m_ScannerID, "00001");
> > dboScanners.m_Scans = 100;
> > dboScanners.m_LastCalibration.year = 2005;
> > dboScanners.m_LastCalibration.month = 6;
> > dboScanners.m_LastCalibration.day = 6;
> > dboScanners.m_LastCalibration.hour = 12;
> > dboScanners.m_LastCalibration.minute = 30;
> > dboScanners.m_LastCalibration.second = 0;
> > hr = dboScanners.Insert(); // hr is -2147467259
> > }
> >
> > Am I do anything wrong? Any help would be appreciated.
>
> 80004005 is E_FAIL, so I suspect some general error. But one
> thing that occurs to me is that you don't fill in fraction,
> so you have some junk there. Set it to 0 to sort that out.
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
>
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
>
.