Results 1 to 3 of 3

Thread: use an sql insert statemant with a comma value

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Location
    Faroe Islands
    Posts
    15

    use an sql insert statemant with a comma value

    HI.

    my problem is that I am trying to put a commavalue into a database, useing an insert statement.

    the sqlcommand goes kinda like this:

    insert into tbl1 (value1, value2) values (" & DTMain.CellSet(Row, 5).Value & ",'" & DTMain.CellSet(Row, 6).Value & "')"




    the float value(number)
    the string value


    please help me.

    best regards snorri

  2. #2
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    what problems are you having? is it not accepting the syntax or what?

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    You have to strip it of the comma character.

    VB Code:
    1. insert into tbl1 (value1, value2) values (" & Format(DTMain.CellSet(Row, 5).Value, "###0.00000") & ",'" & DTMain.CellSet(Row, 6).Value & "')"

    If you leave the comma in there, SQL will misinterpret the comma as the field delimiter and return an errror.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width