0

I start programming in Vb6 a few weeks ago, and I have a big problem now…
When I like to insert Date in .dbf table from my VB6 Application, I get the error:

Malformed GUID. In query expression

My SQL string:
strSQL = "INSERT INTO stok_sme (Date_time) VALUES ({^" & Format(datdw, "yyyy-mm-dd") & "})"

If I try this string (with Values, normally) in Visual FoxPro, everything works fine. But if I try this from Vb6 Application, I get the ERROR…
I’m thinking that I have problem with the {^….}…..

Can somebody help me?

4
Contributors
3
Replies
7
Views
9 Years
Discussion Span
Last Post by Shark_1
0

Wrong:

strSQL = "INSERT INTO stok_sme (Date_time) VALUES ({^" & Format(datdw, "yyyy-mm-dd") & "})"

correct:

strSQL = "INSERT INTO stok_sme (Date_time) VALUES (#" & Format(datdw, "yyyy-mm-dd") & "#)"
0

how about date plus clock format?
strSQL1 = "insert into stok_sme values ('" & Format(TGLMASUK, "dd-mmm-yyyy hh:mm:ss") & "')"
i have eeror... pls help me

0

In vb it is the syntax to write the DateTime value you must be prefixed and sufixed the value by Hash Character i.e. #.

Dim CurDateTime As Date
CurDateTime = #1/16/2015 9:15:30 AM#

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.