Results 1 to 4 of 4

Thread: mysql with auto_increment Insert problem.

  1. #1
    Join Date
    Nov 2005

    mysql with auto_increment Insert problem.

    So I have an auto increment column (As my first column), but I don't know how to write the insert command because of it.
    I tried like that:
    objConn.Execute("INSERT INTO TABLE VALUES ('','SecondElement')")

    But it didn't work

    I tried to write the right number, meanning
    objConn.Execute("INSERT INTO TABLE VALUES ('1','SecondElement')")

    and it work, but I want a general command, because I don't want a check each time, what should be the next number, anyone knows how to do it?

    Thanks in advanced, Oz.

  2. #2
    Join Date
    Feb 2003
    pass the field names that you are inserting. let's say your table looks like this
    id (the auto-increment field)

    then your sql becomes
    insert into myTable (name, address) Values('russell', '123 main street')

  3. #3
    Join Date
    Nov 2005
    I have 20 fields, so I want a do it diffrentely, do you know how to do it?

  4. #4
    Join Date
    Jun 2005
    WI, US
    you don't pass anything for the auto number field, mysql takes care of that. your insert sql statement must be in that format to work correctly. just don't put anything in there for the auto number field liked russell mentioned

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles