Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 18th, 2006, 03:36 PM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB6 -> FoxPro 9 Data Type Issues

I am using the following string to send values from VB6 to the FoxPro database. My problem is that some of the values in FoxPro must be numeric data types. I can not figure out how to format my string to get this to happen. I figured out that the {} symbols are used for declaring a date type, but can not figure out the numeric type.

test = "INSERT INTO inspdrwg VALUES ('" & swModelName & "' , '" & dbRev & "', '" & dbDim & "' , '" & dbDimName & "' , '" & dbInsp & "', ' {dbTolMax} ', '" & dbTolMin & "', '" & dbTolName & "', '" & dbMaterial & "', '" & dbSurfArea & "', '" & dbSheetNo & "', {dbDate})"

Any help will be greatly appreciated.
 
Old July 19th, 2006, 04:55 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I would think:
Code:
    test = "INSERT INTO inspdrwg " & _
            "VALUES ('" & swModelName & "', '" & dbRev & "',      " & _
            "        '" & dbDim & "' ,      '" & dbDimName & "',  " & _
            "        '" & dbInsp & "',      " & dbTolMax & ",     " & _
            "         " & dbTolMin & ",     '" & dbTolName & "',  " & _
            "        '" & dbMaterial & "',  '" & dbSurfArea & "', " & _
            "        '" & dbSheetNo & "',   " & dbDate & "        )"
            The . . . '" & var & "', . . . turns into . . . '$$$$', . . . when the statement is evaluated (wherein the dollar signs represent whatever the value of your different variables are). The leading and trailing single quotes delimit all that is between them as a literal string to the SQL engine. To have something interpreted as a number, it must not have the “mark-ups” that signify it as a string. I don't know what the {}s do for you, but I don't think it is in fact type conversion, nor type declaration.

So what you need to wind up sending to the SQL engine would be something like:
Code:
   "INSERT INTO inspdrwg " & _
    "VALUES ('Alpha Baby',     'A',      " & _
    "        '2.34cm' ,        'Ear Height',  " & _
    "        'My Inspiration', 345.297,     " & _
    "        24.5,             'Nose Flair',  " & _
    "        'Flesh',          '15 Sq m', " & _
    "        'Sh 12',          12589.2589        )"[/





Similar Threads
Thread Thread Starter Forum Replies Last Post
vb6 .exe login issues Jade08 Beginning VB 6 8 May 7th, 2008 08:10 AM
Update SQL table with data from FoxPro system sofya SQL Server 2000 6 November 4th, 2004 06:45 PM
<input type="File"> - Specify File Type and Path gp_mk Classic ASP Basics 2 August 2nd, 2004 03:07 AM
Converting int64 data type in VB6 yeeck VB How-To 1 December 9th, 2003 10:13 PM
Converting int64 data type in VB6 yeeck Beginning VB 6 0 November 27th, 2003 11:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.