Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006
    Posts
    9

    Unanswered: Please Help me with an error !!

    Helo. Me again with a big problem.
    conexao.Execute ("Insert into dados_anterior ( " & A & " ) values('" & B & "','" & C & "','" & D & "','" & E & "','" & F & "','" & G & "','" & H & "','" & I & "','" & J & "','" & K & "','" & L & "','" & M & "','" & N & "','" & O & "','" & P & "','" & Q & "','" & R & "','" & S & "','" & T & "','" & U & "','" & V & "','" & X & "','" & W & "','" & Y & "', '" & Z & "','" & AA & "','" & AB & "','" & AC & "','" & AD & "','" & AE & "','" & AF & "','" & AG & "','" & AH & "','" & AI & "','" & AJ & "','" & AK & "','" & AL & "','" & AM & "','" & AN & "','" & AO & "','" & AP & "','" & AQ & "','" & AR & "','" & ASS & "','" & AT & "','" & AU & "','" & AV & "','" & AX & "','" & AW & "','" & AY & "','" & AZ & "','" & BA & "','" & BB & "','" & BC & "','" & BD & "','" & BE & "','" & BF & "','" & BG & "','" & BH & "','" & BI & "','" & BJ & "','" & BK & "','" & BL & "')")
    this lettes are all variables and when I execute this code after likwe 5 minutes appears the message Error in SQL sintax ,but this appears ater two minnutes ,and the fileds in mysql are also filled. A am using excel VBA what should i do to execute this code like i have 63 fields to mysql and the line conexao.execute in VBA you can´t read all letters mix could be this:? and how can I divide the code in mysql? like the 63 fields are one register

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Try this.
    Code:
    dim strSQL as String
    strSQL = "Insert into dados_anterior ( " & A & " ) values('" & B & "','" & C & "','" & D & "','" & E & "','" & F & "','" & G & "','" & H & "','" & I & "','" & J & "','" _
            & K & "','" & L & "','" & M & "','" & N & "','" & O & "','" & P & "','" & Q & "','" & R & "','" & S & "','" & T & "','" & U & "','" & V & "','" & X & "','" & W & "','" _ 
            & Y & "', '" & Z & "','" & AA & "','" & AB & "','" & AC & "','" & AD & "','" & AE & "','" & AF & "','" & AG & "','" & AH & "','" & AI & "','" & AJ & "','" & AK & "','" _
            & AL & "','" & AM & "','" & AN & "','" & AO & "','" & AP & "','" & AQ & "','" & AR & "','" & ASS & "','" & AT & "','" & AU & "','" & AV & "','" & AX & "','" & AW _
            & "','" & AY & "','" & AZ & "','" & BA & "','" & BB & "','" & BC & "','" & BD & "','" & BE & "','" & BF & "','" & BG & "','" & BH & "','" & BI & "','" & BJ & "','" & BK _
            & "','" & BL & "')"
    conexao.Execute strSQL

    In this way, you can stop execution of your code and look at the contents of strSQL BEFORE you use it.

    Now, the string contents of "A" must hold the entire field list. And, you must NOT use delimiters (') for numeric field types.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •