1 Attachment(s)
NEW Mysql Server prob to insert query date
Code:
SQL = "INSERT INTO UTENZE ([APRI], [USER] , [A_ORA], [NOMINATIVO]) VALUES (CURDATE(),'" & _
VETTORE & "',CURTIME(),'" & UTENTE_CORRENTE & "')"
CONN.Execute SQL, , adCmdText + adExecuteNoRecords
have error in image.
note:
the last var UTENTE_CORRENTE in this case is blank
APRI and A_ORA are datetime
USER and NOMINATIVO are Varchar
my conn:
Option Explicit
Public Function connectMysql(USERNAME As String, PASSWD As String, SERVERIP As String, DB As String, CONN As ADODB.Connection, RS As ADODB.Recordset)
Set CONN = New ADODB.Connection
With CONN
.CommandTimeout = 999999
.ConnectionTimeout = 999999
.Mode = adModeReadWrite
.CursorLocation = adUseClient
.ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=" & SERVERIP & ";UID=" & USERNAME & ";PWD=" & PASSWD & ";DATABASE=" & DB & ";" & _
"OPTION=3"
.Open
End With
End Function
Sub INIZIO1()
If CONN Is Nothing Then
Call connectMysql("root", "sal21", "127.0.0.1", "BT", CONN, RS)
End If
End Sub
Re: NEW Mysql Server prob to insert query date
Does you column names have brackets ([]) in them? MySQL doesn't use the [] like MSSQL does for mysql you would do `APRI`
Re: NEW Mysql Server prob to insert query date
Quote:
Originally Posted by
smendoza
Does you column names have brackets ([]) in them? MySQL doesn't use the [] like MSSQL does for mysql you would do `APRI`
OK!!!
FIRST STEEP RESOLVED, TKS.!!!!!!!!
but to insert date is correct the format yyy-mm-dd and hh:mm:ss
if yes how to insert this two element in a vb6 string query?
with #" ...."# similar access string query or...?
Re: NEW Mysql Server prob to insert query date
What data type is your APRI column? CURDATE() should insert the date into the date column in the correct format. I know Toad for mySQL reformats the data to mm/dd/yyyyy HH:MM:SS.
If you want to type in a date just wrap it in qoutes like this -> '2013-03-22'
Here is all the Date functions for mysql
https://dev.mysql.com/doc/refman/5.5...functions.html