dcsimg
Results 1 to 5 of 5

Thread: [RESOLVED] matching up data types

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    54

    Resolved [RESOLVED] matching up data types

    hello im am trying to match up data types in a sql statement i know the date is # " * Me.Date & " # and a string would be " & Me.Customer & " ' i can not figure out what the rest would be, how would i represent a number


    Name:  Capture.PNG
Views: 164
Size:  13.7 KB

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,124

    Re: [RESOLVED] matching up data types

    For an explanation and examples of delimiters to use around values within SQL statements, see the article How do I use values (numbers, strings, dates) in SQL statements? from our Database Development FAQs/Tutorials (at the top of the Database Development forum)

    It doesn't mention Memo, but I think that is treated the same as String/Text.

    Note that when putting values into an SQL statement via code, it is far better to use Parameters instead of appending the values as you did, the article above has a link in it for more info.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    54

    Re: [RESOLVED] matching up data types

    Quote Originally Posted by si_the_geek View Post
    For an explanation and examples of delimiters to use around values within SQL statements, see the article How do I use values (numbers, strings, dates) in SQL statements? from our Database Development FAQs/Tutorials (at the top of the Database Development forum)

    It doesn't mention Memo, but I think that is treated the same as String/Text.

    Note that when putting values into an SQL statement via code, it is far better to use Parameters instead of appending the values as you did, the article above has a link in it for more info.
    what is parmeters

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,124

    Re: [RESOLVED] matching up data types

    Parameters are a way of passing the values to the database (as values), rather than appending them into the SQL statement (as Strings, which you need to format and delimit appropriately for the database you are using).

    They have several significant benefits (and the downsides are ignorable), so using them is very widely regarded as a wise move.

    More info is in the article I mentioned before: Why should I use Parameters instead of putting values into my SQL string?

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,811

    Re: [RESOLVED] matching up data types

    Quote Originally Posted by cubsm22p View Post
    i can not figure out what the rest would be, how would i represent a number
    Think about how it works in VB. Date literals are delimited with # symbols and string literals are delimited with double-quotes but how are numeric and Boolean literals delimited? They aren't. Jet SQL is basically the same, with the only difference being that strings are delimited with single-quotes instead of double-quotes.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width