Re: ADO/MyODBC Error with TIME fields.

Daniel Kasak <[email protected]>
Newsgroups gmane.comp.db.mysql.odbc
Message-ID <[email protected]>
[email protected] wrote:
>  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"
>   

Have you tried:
MiSet!Time1 = "01:00:00"

I've found it's more reliable ( and portable ) if you don't use 
recordset objects like this for updates. You can *read* from them, but 
any updates I always do by assembling an 'update table' command and 
sending it via the ADO connection.

-- 
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [email protected]
website: http://www.nusconsulting.com.au

-- 
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.