I hope to find assistance. I am using ASP.Net C#. The database was created inside Visual Studio using SQL Server 2008 and I made some tables. Its primary key auto increments, but some tables I am not using the auto increment property. I want to make increment using code.
If I have 3 tables(account, manager, project) for example, when a user 1 create account the account_id will auto increment and when select account type manager the manager_id I want to increment by code. User 1 with account_id 1 and manager_id 1 able to create multiple projects.
and this is part of my database:
create table account (
account_id int(8) PRIMARY KEY AUTO_INCREMENT,
username char(12) not null ,
email varchar (50) not null,
password varchar (20) not null
account type int (5)
);
create table profile (
profile_id int(8) PRIMARY KEY AUTO_INCREMENT,
first_name varchar (20),
last_name varchar(20),
gender char(10),
country char (15),
phone_number int(15),
profile_description varchar (100),
account_id int (8),
manager_id int (8),
team_id int(8),
client_id int(8),
Constraint profile_fk foreign key (account_id) references account (account_id),
Constraint profile_fk2 foreign key (manager_id) references manager (manager_id),
Constraint profile_fk3 foreign key (team_id) references team (team_id ),
Constraint profile_fk4 foreign key (client_id) references client (client_id),
);
create table manager (
manager_id int(8) PRIMARY KEY ,
project_id int(8),
Constraint manager_fk1 foreign key (project_id ) references project (project_id )
);
create table project (
project_id int(8)PRIMARY KEY AUTO_INCREMENT,
project_name char (15),
project_description varchar(100),
);