dcsimg
Results 1 to 6 of 6

Thread: [RESOLVED] problem with query ?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2009
    Location
    Scotland/Japan
    Posts
    164

    Resolved [RESOLVED] problem with query ?

    sqlquery = "CREATE TABLE " & TextBox1.Text & "(teka varchar(100) NOT NULL, sub varchar(80) NOT NULL, dat varchar(45) NOT NULL, unread varchar(4) NOT NULL DEFAULT yes, msg varchar(10000) NOT NULL, PRIMARY KEY (teka) USING BTREE) ENGINE=InnoDB DEFAULT CHARSET=latin1"

    i run this on a user registration but for some reason it errors out saying theres a syntax error

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '12 (teka varchar(100) NOT NULL, sub varchar(80) NOT NULL, dat varchar(45) NOT NU' at line 1

    and knowing my luck with sql theres more than one error in there if anyone knows how to fix my mess it would be great

    Between the world we see and the things we fear theres a realm of possibility

    D.L.H. Ind.

    We do what we do in out life to make Yours Simpler

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,277

    Re: problem with query ?

    I'm not familiar with MySQL, but shouldn't there be a space before the left parenthesis?
    ..." (teka....
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2009
    Location
    Scotland/Japan
    Posts
    164

    Re: problem with query ?

    yes but thats not the issue... ichanged it and it still errors out
    Between the world we see and the things we fear theres a realm of possibility

    D.L.H. Ind.

    We do what we do in out life to make Yours Simpler

  4. #4
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,612

    Re: problem with query ?

    I assume you are trying to create a table named "12" or atleaset your textbox contains "12"
    These types of names (names starting with number) are not allowed in almost any database or programming language.

    Try naming it meaningfully. Like "table12" etc.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." Charles F. Kettering

    Read articles on My Blog 101 LINQ Samples JSON Validator XML Schema Validator "How Do I" videos on MSDN VB.NET and C# Comparison Good Coding Practices VBForums Reputation Saver String Enum Super Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  5. #5
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: problem with query ?

    Show people what is in your TextBox1.Text. It may contains a space or invalid character?
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    Baby Steps a guided tour
    IsDigits() and IsNumber() functions Wichmann-Hill Random() function >> and << functions for VB CopyFileByChunk

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,098

    Re: problem with query ?

    Rather than just showing us the code that creates the query, you should show us the actual query that is being run - as the code by itself only allows us to guess what the query might be.


    For more info on what Pradeep mentioned (and links to Reserved words, which you should check) , see the article What names should I NOT use for tables/fields/views/stored procedures/...? from our Database Development FAQs/Tutorials (at the top of this forum)


    There also seems to be a bit of an issue here:
    , unread varchar(4) NOT NULL DEFAULT yes,
    If you want the default to be the text "yes", you need to use a text value - rather than the name of an object (function/table/...) that probably doesn't exist.

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