CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: SQL

  1. #1
    Join Date
    Apr 1999
    Posts
    29

    SQL

    HI!!
    For example, I have this:
    sqlwords = "insert into aaaa values('" & txt_name.Text & "'," & Val(txt_number.Text) & ")"
    ConectionA.Execute sqlwords

    In txt_number.Text I have a number with format. For example: 128.23
    But the string named sqlwords, takes this number like 128,23
    And the execution fails.
    What can I do? Thanks in advance.



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: SQL

    remove the Val function as in

    Dim sqlwords as string
    sqlwords = "insert into aaaa values('" & txtName.Text & "'," & txtNumber.Text & ")"
    MsgBox sqlwords






  3. #3
    Join Date
    Jun 1999
    Posts
    42

    Re: SQL

    Check the regional configuration of your computer, I had the same problem with this I use date and numbers and received errors in return or just a wrong string
    Also if you have in SQL a column with the type number and you are sending a string like this '" & text.text & "' you will receive an error use this for the number type columns " & text.text & "

    Hope this helps you
    Regards


  4. #4
    Join Date
    Aug 1999
    Posts
    8

    Re: SQL

    Use Cdbl instead of using Val function since The val function converts into Numeric value so i suggest you tu use
    CDbl where it takes the decimal value in the database


  5. #5
    Join Date
    Apr 1999
    Posts
    29

    Re: SQL

    Thanks to all !
    The problem was the Val function and the Format function.


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

Featured