+ Reply to Thread
Results 1 to 2 of 2

Thread: Small question regarding database!

  1. #1
    Newbie Trix09 is an unknown quantity at this point Trix09's Avatar
    Join Date
    Apr 2009
    Posts
    8

    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. #2
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,689
    Blog Entries
    57

    Re: Small question regarding database!

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

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Database Query/Logic Question ?
    By romeo0830 in forum Database & Database Programming
    Replies: 9
    Last Post: 02-19-2009, 07:14 PM
  2. Small noob question !
    By Turk4n in forum C and C++
    Replies: 6
    Last Post: 01-14-2009, 04:43 AM
  3. Tutorial: Java Database Connectivity
    By Jordan in forum Java Tutorials
    Replies: 1
    Last Post: 10-08-2008, 04:26 AM
  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, 07:57 AM
  5. Replies: 4
    Last Post: 04-11-2007, 11:41 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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