SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Query Stops Working....

    As soon as I add an extra argument to it.

    Code:
      
      			String query = "INSERT INTO logged_calls" +
     			 "(firstName,secondName,telNumber,priority,dept,assetNum,category,summary,description,group)" +
      				"VALUES" +
     			 "('" + firstName + "','" + secondName + "','" + telNumber + "','" + priority + "','" + dept + "','" + assetNum + "','" + category + "','" + summary + "','" + description + "','" + group + "')";
    If I remove the last bit I added, the group and group variable, so the query is as below


    Code:
       
       			String query = "INSERT INTO logged_calls" +
     			 "(firstName,secondName,telNumber,priority,dept,assetNum,category,summary,description)" +
       				"VALUES" +
     			 "('" + firstName + "','" + secondName + "','" + telNumber + "','" + priority + "','" + dept + "','" + assetNum + "','" + category + "','" + summary + "','" + description + "')";
    Everything works fine. Is there some sort of limit to how many fields I can pull out or anything, as there is nothing wrong with the code.

    Its only an access database but I wouldnt think this would be a problem.

    Thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    whaddya bet GROUP is a reserved word, eh

    for Access, you escape reserved words with square brackets
    Code:
    INSERT INTO ... ( ... [group] ... ) VALUES ...
    better would be to rename the column

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tut...... Never even thought it could be that! Thanks so much rudy!



Bookmarks

Posting Permissions

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