Solved

problem to upadte foxpro table with VFPOLEDB VB datat type mismatch

Posted on 2011-03-11
4
1,165 Views
Last Modified: 2012-05-11
Hi im trying to update foxpro table but when I update datetime filed I get data type mismatch.

 Dim strSelect As String = "INSERT INTO expense (Expno, Editpc, Edituser, Edittime) VALUES (" & ConfoRequest.FSExpNo & ", """ & ConfoRequest.FSPC & _
             """,""" & ConfoRequest.FSCreatedBy & """,""" & Now & """)"

Open in new window


0
Comment
Question by:gowerman
  • 3
4 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 35107771
Correct nonambiguous datetime format in VFP is:

{^YYYY.MM.DD HH:MM:SS}

You could also try ambiguous format:

...   & """,""{" & Now & "}"")"

which can be refused by VFP (this depends on SET DATE and SET STRICTDATE settings).

Additional options are 1) parameter in INSERT command or 2) DATETIME function in INSERT.

DATETIME has 6 parameters and its creation as a string will look ugly, so the parameter seems to be the easiest option.
0
 
LVL 41

Expert Comment

by:pcelba
ID: 35107814
Hmm, some features of VB.NET are not bad...

Now.ToString("{^yyyy/mm/dd hh:mm:ss}")   is exactly what you need.

0
 

Author Comment

by:gowerman
ID: 35107926

If i try & """,""{" & Now & "}"")"  then error is to many arguments and
strSelect = "INSERT INTO expense (Expno, Editpc, Edituser, Edittime) VALUES (1110620, "ROB","xxx","","{11/03/2011 13:17:08}")"

when I try Now.ToString("{^yyyy/mm/dd hh:mm:ss}") then I have same error and my string looks like that

strSelect = "INSERT INTO expense (Expno, Editpc, Edituser, Edittime) VALUES (1110620, "ROB","xxx","{^2011/19/11 01:19:34}")"

when I change "/" to "."  then same data type mismatch

0
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 35107959
My fault. Double quotes must be removed:

...   & """, " & Now.ToString("{^yyyy/mm/dd hh:mm:ss}") & ")"

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now