Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Unanswered: SQL statement INSERT INTO and objects

    Can I use the SQL statement INSERT INTO to send OLEObjects to tables.
    Currently I've the following code:

    varSQL = "INSERT INTO tblObras VALUES ('" & txtCodObra & "','" & txtCodArmario & "','" & txtCodPrateleira & "','" & cboCodCliente & "','" & txtTipoDeObra & "','" & txtDataDeFecho & "','" & Date & "','" & txtObservacoes & "', '" & imgDesenhoPeca & "' );"

    were all the fields refers to text or numbers contained in text and comboboxes except the last one, it's a picture (OLEObject)!
    If i turn the last one into text or number (i.e. a text or combobox) no problems, through a connection I can send all the data to tables, if i turn it into a OLEObject (jpeg file) occurs an error because of the SQL statement.

    Can anyone help me?

  2. #2
    Join Date
    Feb 2004
    Posts
    199
    imgDesenhoPeca is OLE Object?
    than you can't assign it to a field as text like you do.
    Which versoin of SQL you have - Access JET or MS SQL?
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  3. #3
    Join Date
    Feb 2004
    Posts
    5
    Originally posted by Kakha
    imgDesenhoPeca is OLE Object?
    than you can't assign it to a field as text like you do.
    Which versoin of SQL you have - Access JET or MS SQL?
    I've Access MS.JET.OLEDB.4.0.
    How can I assign the object into a field. I supose the mistake is in the sintaxe I used, right?

  4. #4
    Join Date
    Feb 2004
    Posts
    199
    I've done it in MS SQL (Can't remeber how), and it's not easy, you may try use rst.addnew instead of execute SQL .
    via recordset it's more easyer.
    Actually an object in VBA is an Array of bytes, or Variant type varianble (both are accespteble)
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  5. #5
    Join Date
    Feb 2004
    Posts
    5
    Originally posted by Kakha
    I've done it in MS SQL (Can't remeber how), and it's not easy, you may try use rst.addnew instead of execute SQL .
    via recordset it's more easyer.
    Actually an object in VBA is an Array of bytes, or Variant type varianble (both are accespteble)
    I'm novice in that matter and don't know how to do it. All that i've seen about rst.addnew requires an SQL statement before rst.addnew because is needed what to send to tables!
    Try to help me on SQL or write a statement that can do the same thing using rst.addnew.

    Thanks

  6. #6
    Join Date
    Feb 2004
    Posts
    5
    Originally posted by RuiPTSantos
    I'm novice in that matter and don't know how to do it. All that i've seen about rst.addnew requires an SQL statement before rst.addnew because is needed what to send to tables!
    Try to help me on SQL or write a statement that can do the same thing using rst.addnew.

    Thanks
    Hey, anyone can help me!?

Posting Permissions

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