Closed Thread
Results 1 to 2 of 2

Thread: Small question regarding database!

  1. #1
    Trix09's Avatar
    Trix09 is offline Newbie
    Join Date
    Apr 2009
    Posts
    8
    Rep Power
    0

    Small question regarding database!

    Hello all, I asked my college teacher this and he didnt know the answer!!! Lol, so here i am.....

    I have a database set up in Access 2007, it has a table called UserInfo. In this table it has a field(i think thats right) which is called UserID and is the primary key, and autoincrements.

    Now then, if someone inputs some data, i want it to add the data to the database, and autoincrement the UserID field for me, but i can't get this to work at all.

    At the moment, i have it pre-defined to input the value '1' into the UserID field, but of course if someone enters data again, it gives me an error because '1' exists now.

    This is my current code

    Code:
    procedure TFrmRegister.Button2Click(Sender: TObject);
    begin
      with unit1.FrmSplashPage.q1 do
        begin
        Active:=False;
        SQL.Clear;
        SQL.Add('INSERT into UserInfo VALUES (''1'','''+EdtLogInName.Text+''','''+EdtPassword.Text+''')');
        ExecSQL;
        end;
    end;

    If i remove the bit with the '1' it tells me an error about the amount of fields not being the same as inputs? Something like that sorry!

    I was hoping someone knew what i was doing wrong, it would help me HUGELY. Many thanks

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,525
    Blog Entries
    75
    Rep Power
    144

    Re: Small question regarding database!

    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Small question.
    By Turk4n in forum The Lounge
    Replies: 6
    Last Post: 07-25-2009, 06:07 AM
  2. Small noob question !
    By Turk4n in forum C and C++
    Replies: 6
    Last Post: 01-14-2009, 02:43 AM
  3. Small question on containers
    By Frenzy123 in forum C and C++
    Replies: 2
    Last Post: 02-19-2008, 03:32 PM
  4. Best way to save lots of small values (in a database)?
    By Vantage in forum General Programming
    Replies: 2
    Last Post: 05-14-2007, 05:57 AM
  5. Replies: 4
    Last Post: 04-11-2007, 09:41 AM

Tags for this Thread

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