Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘datetime’

PRB: Error Setting Field Format Property of Access Tables

Symptoms
From Visual Basic, when trying to specify a field Format property of anAccess table (for example, field type DateTime) from blank to “Long Date”format, the following error occurs:

Run-time error ‘3421′:
Data type conversion error.
Resolution
The property data type constant should always be “dbText.” If other datatype constants, such as dbDate or dbNumeric are specified, you willencounter the error described above.

BUG: Error When You Use Client Cursor to Add Record to SQL Server Table That Has Default Value in Datetime Field

Symptoms
If you use ADO to insert a new record through a client-side recordset into a SQL Server table that has a non-nullable datetime field with a default value, you receive the following error message if you do not supply a value for the datetime field:

Run-time error ‘-2147217887 (80040e21)’: Multiple-step operation generated errors. Check each status value. This error occurs whether you use the OLE DB Provider for SQL Server or the OLE DB Provider for ODBC Drivers. The error message may differ when you use Microsoft Data Access Components (MDAC) version 2.5 Service Pack 1 (SP1) or earlier. This error does not occur with a server-side cursor.
Resolution
This error occurs in the Client Cursor Engine when it attempts to convert the value of type DBTYPE_DBTIMESTAMP to DBTYPE_VARIANT.