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


LinkBack URL
About LinkBacks




Reply With Quote



Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum