Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. ODBC

ODBC

Scheduled Pinned Locked Moved Visual Basic
databasehelp
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephen Lintott
    wrote on last edited by
    #1

    Hi all. I am currently looking to insert a value into a memo field in vfp using a odbc connection but keep getting a error (ERROR [22018] [Microsoft][ODBC Visual FoxPro Driver]Data type mismatch). Does anybody know if this is supported by the odbc connection object or does anybody have sample code to do this. The sql is correct this thing just fails with the odbc connection.

    Stephen Lintott Bsc IT (RAU)

    J W 2 Replies Last reply
    0
    • S Stephen Lintott

      Hi all. I am currently looking to insert a value into a memo field in vfp using a odbc connection but keep getting a error (ERROR [22018] [Microsoft][ODBC Visual FoxPro Driver]Data type mismatch). Does anybody know if this is supported by the odbc connection object or does anybody have sample code to do this. The sql is correct this thing just fails with the odbc connection.

      Stephen Lintott Bsc IT (RAU)

      J Offline
      J Offline
      Jay Royall
      wrote on last edited by
      #2

      You say that the SQL is correct, what type of database have you tested it on? The reason I ask is because I believe that the required type of data can vary between database engines. If you haven't done so already (and I apologise if you have), I would test the SQL on the VFP database directly.

      1 Reply Last reply
      0
      • S Stephen Lintott

        Hi all. I am currently looking to insert a value into a memo field in vfp using a odbc connection but keep getting a error (ERROR [22018] [Microsoft][ODBC Visual FoxPro Driver]Data type mismatch). Does anybody know if this is supported by the odbc connection object or does anybody have sample code to do this. The sql is correct this thing just fails with the odbc connection.

        Stephen Lintott Bsc IT (RAU)

        W Offline
        W Offline
        Wendelius
        wrote on last edited by
        #3

        Could yo post the code. Perhaps the problem is in the parameter usage.

        The need to optimize rises from a bad design.My articles[^]

        S 1 Reply Last reply
        0
        • W Wendelius

          Could yo post the code. Perhaps the problem is in the parameter usage.

          The need to optimize rises from a bad design.My articles[^]

          S Offline
          S Offline
          Stephen Lintott
          wrote on last edited by
          #4

          After a discusion with the developer in charge of this I found out that the following sql statement causes the break. If anyone can see why I would surely appreaciate it. I sure can't it seems correct to me.

          INSERT INTO OrdHeader (Uniqueid,trantype,ledgerno,accountid,userno,entrydate,entrytime,lineno, trandate,periodno,batchno,internref,externref,hedgecode,logged,descriptn,payee,presented,held,previous,ositem,ledger2, account2,taxtype1,taxcode1,taxamount1,taxtype2,taxcode2,taxamount2,taxtype3,taxcode3,taxamount3,salescode,costcode,stage, branch,delivery,quantity1,quantity2,quantity3,amount1,amount2,amount3,amount4,amount5,cncycode,exchange,netvarnce,netgain, netloss,taxrebate,duedate,rateid,staffid,complqty,ppsrate,purchtype,isjobquote,rpsgross,recordno,temppres,changed,discperc, taxperiod,zcostproc,zpostatus) Values(5,49,2,'CNBPZF@CQU',1, CTOD('1/26/2009'),58694.616,0,CTOD('12/31/2008'),78, 356550,'PO-JAC01360 ','PO-JAC ','N','F' ,'Purchase Order ',' ',0,'F','F' ,'F',2,'CNBPZF@CQU',' ',0,0 ,' ',0,-69.96,' ',0 ,0,0,' 0',' 0',1 ,CTOD('12/31/2008'),0,0,0 ,-699.56,0,-699.56,0,0 ,0,1,0,0,0 ,0,CTOD('12/30/1899 12:00:00 AM'),'F ','F ',0 ,0,0,'F',0,0 ,0,'T',0,0,' ' ,' ')

          Stephen Lintott Bsc IT (RAU)

          W B 2 Replies Last reply
          0
          • S Stephen Lintott

            After a discusion with the developer in charge of this I found out that the following sql statement causes the break. If anyone can see why I would surely appreaciate it. I sure can't it seems correct to me.

            INSERT INTO OrdHeader (Uniqueid,trantype,ledgerno,accountid,userno,entrydate,entrytime,lineno, trandate,periodno,batchno,internref,externref,hedgecode,logged,descriptn,payee,presented,held,previous,ositem,ledger2, account2,taxtype1,taxcode1,taxamount1,taxtype2,taxcode2,taxamount2,taxtype3,taxcode3,taxamount3,salescode,costcode,stage, branch,delivery,quantity1,quantity2,quantity3,amount1,amount2,amount3,amount4,amount5,cncycode,exchange,netvarnce,netgain, netloss,taxrebate,duedate,rateid,staffid,complqty,ppsrate,purchtype,isjobquote,rpsgross,recordno,temppres,changed,discperc, taxperiod,zcostproc,zpostatus) Values(5,49,2,'CNBPZF@CQU',1, CTOD('1/26/2009'),58694.616,0,CTOD('12/31/2008'),78, 356550,'PO-JAC01360 ','PO-JAC ','N','F' ,'Purchase Order ',' ',0,'F','F' ,'F',2,'CNBPZF@CQU',' ',0,0 ,' ',0,-69.96,' ',0 ,0,0,' 0',' 0',1 ,CTOD('12/31/2008'),0,0,0 ,-699.56,0,-699.56,0,0 ,0,1,0,0,0 ,0,CTOD('12/30/1899 12:00:00 AM'),'F ','F ',0 ,0,0,'F',0,0 ,0,'T',0,0,' ' ,' ')

            Stephen Lintott Bsc IT (RAU)

            W Offline
            W Offline
            Wendelius
            wrote on last edited by
            #5

            If you execute that directly against the database without your application, does it fail?

            The need to optimize rises from a bad design.My articles[^]

            S 1 Reply Last reply
            0
            • S Stephen Lintott

              After a discusion with the developer in charge of this I found out that the following sql statement causes the break. If anyone can see why I would surely appreaciate it. I sure can't it seems correct to me.

              INSERT INTO OrdHeader (Uniqueid,trantype,ledgerno,accountid,userno,entrydate,entrytime,lineno, trandate,periodno,batchno,internref,externref,hedgecode,logged,descriptn,payee,presented,held,previous,ositem,ledger2, account2,taxtype1,taxcode1,taxamount1,taxtype2,taxcode2,taxamount2,taxtype3,taxcode3,taxamount3,salescode,costcode,stage, branch,delivery,quantity1,quantity2,quantity3,amount1,amount2,amount3,amount4,amount5,cncycode,exchange,netvarnce,netgain, netloss,taxrebate,duedate,rateid,staffid,complqty,ppsrate,purchtype,isjobquote,rpsgross,recordno,temppres,changed,discperc, taxperiod,zcostproc,zpostatus) Values(5,49,2,'CNBPZF@CQU',1, CTOD('1/26/2009'),58694.616,0,CTOD('12/31/2008'),78, 356550,'PO-JAC01360 ','PO-JAC ','N','F' ,'Purchase Order ',' ',0,'F','F' ,'F',2,'CNBPZF@CQU',' ',0,0 ,' ',0,-69.96,' ',0 ,0,0,' 0',' 0',1 ,CTOD('12/31/2008'),0,0,0 ,-699.56,0,-699.56,0,0 ,0,1,0,0,0 ,0,CTOD('12/30/1899 12:00:00 AM'),'F ','F ',0 ,0,0,'F',0,0 ,0,'T',0,0,' ' ,' ')

              Stephen Lintott Bsc IT (RAU)

              B Offline
              B Offline
              Ben Fair
              wrote on last edited by
              #6

              I notice multiple booleans that appear as single character strings ('T' or 'F'). Are those fields actually character type or boolean type? In VFP .T. and .F. are used to indicate booleans. If you are using parameters for the ODBC command and assign a boolean value to them it should handle them for you, but if you are specifying their values in the command text then you may need to use the VFP boolean syntax.

              Hope in one hand and poop in the other; see which fills up first. Hope and change were good slogans, now show us more than words.

              1 Reply Last reply
              0
              • W Wendelius

                If you execute that directly against the database without your application, does it fail?

                The need to optimize rises from a bad design.My articles[^]

                S Offline
                S Offline
                Stephen Lintott
                wrote on last edited by
                #7

                It fails when running it against a RBDMS. The booleans don't cause any havoc. It inserts to9 the Description field and then no more

                Stephen Lintott Bsc IT (RAU)

                W 1 Reply Last reply
                0
                • S Stephen Lintott

                  It fails when running it against a RBDMS. The booleans don't cause any havoc. It inserts to9 the Description field and then no more

                  Stephen Lintott Bsc IT (RAU)

                  W Offline
                  W Offline
                  Wendelius
                  wrote on last edited by
                  #8

                  Since I don't know the structure of your table, I'm not able to sy if all the values are in correct places. However, you could check if the pairs match (if not done so already) Here's the colum/value list in different format. The Descriptn value look quite large, perhaps it's over the max length?

                  Uniqueid 5
                  trantype 49
                  ledgerno 2
                  accountid 'CNBPZF@CQU'
                  userno 1
                  entrydate CTOD('1/26/2009')
                  entrytime 58694.616
                  lineno 0
                  trandate CTOD('12/31/2008')
                  periodno 78
                  batchno 356550
                  internref 'PO-JAC01360 '
                  externref 'PO-JAC '
                  hedgecode 'N'
                  logged 'F'
                  descriptn 'Purchase Order

                                                                  '
                  

                  payee ' '
                  presented 0
                  held 'F'
                  previous 'F'
                  ositem 'F'
                  ledger2 2
                  account2 'CNBPZF@CQU'
                  taxtype1 ' '
                  taxcode1 0
                  taxamount1 0
                  taxtype2 ' '
                  taxcode2 0
                  taxamount2 -69.96
                  taxtype3 ' '
                  taxcode3 0
                  taxamount3 0
                  salescode 0
                  costcode ' 0'
                  stage ' 0'
                  branch 1
                  delivery CTOD('12/31/2008')
                  quantity1 0
                  quantity2 0
                  quantity3 0
                  amount1 -699.56
                  amount2 0
                  amount3 -699.56
                  amount4 0
                  amount5 0
                  cncycode 0
                  exchange 1
                  netvarnce 0
                  netgain 0
                  netloss 0
                  taxrebate 0
                  duedate CTOD('12/30/1899 12:00:00 AM')
                  rateid 'F '
                  staffid 'F '
                  complqty 0
                  ppsrate 0
                  purchtype 0
                  isjobquote 'F'
                  rpsgross 0
                  recordno 0
                  temppres 0
                  changed 'T'
                  discperc 0
                  taxperiod 0
                  zcostproc ' '
                  zpostatus ' '

                  The need to optimize rises from a bad design.My

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups