Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
ADO/MyODBC Error with TIME fields.

ADO/MyODBC Error with TIME fields.

2006-12-15       - By rafarife@(protected)

 Back
Reply:     1     2     3  

Hello,
I have a problem when I try to create a record with a TIME field using a client
-cursor.

I am using Visual Basic 6.0, MyOdbc 3.51.12, Windows 2000 and ADO 2.8, and
I have found the problem both in Mysql 4.0 and Mysql 4.1 (latest versions) with
InnoDB.

Here is the table:
-- ---- ---- ----
CREATE TABLE `prueba` (`Doc` varchar(10) NOT NULL default '',
                      `Time1` time NOT NULL default '00:00:00'
                       ,PRIMARY KEY  (`Doc`)) TYPE=InnoDB;

Here is the code:
-- ---- ---- ---
Private Sub Command1_Click()
On Error GoTo mal

Dim Conexion As ADODB.Connection
Dim Opciones As Long, RAfec As Long

Set Conexion = New ADODB.Connection

Opciones = 1 + 2 + 8 + 16384

'Open the connection
Conexion.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
                     & "SERVER=myServer;" _
                     & "UID=root;PWD=myPWD;OPTION=" & Str$(Opciones)
Conexion.Open

'Use TEST
Conexion.Execute "Use test", RAfec, adCmdText + adExecuteNoRecords

'open the cursor
Dim MiSet As ADODB.Recordset, MiSQL As String
Set MiSet = New ADODB.Recordset

'SELECT
MiSQL = "select * from prueba"

'Configuring then cursor
MiSet.CursorLocation = adUseClient
MiSet.CursorType = adOpenStatic
MiSet.LockType = adLockOptimistic
MiSet.Properties("Update Criteria") = adCriteriaKey
MiSet.Properties("Update Resync") = adResyncNone

'Open the cursor
MiSet.Open MiSQL, Conexion, , , adCmdText 'This opens the cursor. (Ok)

'Let's go
MsgBox "Now, We will try to create a new record"

'This does not run
MiSet.AddNew
MiSet!Doc = "AA00123456"
MiSet!Time1 = "01:00"
'
'Update!
MiSet.Update 'ERROR ...
Exit Sub
mal:
  MsgBox Err.Description
'I get the following error:
'[MySQL][ODBC 3.51 Driver][mysqld-4 (See http://qld-4.ora-code.com).0.20a-nt-max-log]
'Something is wrong in the sintax ''100:00:00)' en la linea 1
'ADO/MyODBC tries the following SQL:
'INSERT INTO `prueba` (`Doc`,`Time1`) VALUES ('AA00123456','100:00:00)
'
End Sub

'You can see that '100:00:00) is wrong
'
'If I change
'
'...
'MiSet!HoraInicio="01:15" or MiSet!HoraInicio="02:00"
'MiSet.update
'
'It's ok!!! I have only the problem with MiSet!HoraInicio="01:00"
'
Is an ADO or MyODBC problem?

Thanks in advance,
Rafa

__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
Check Out the new free AIM(R) Mail -- 2 GB of storage and industry-leading spam
and email virus protection.