I have the following two connected tables as shown below in the Microsoft SQL Server.
When inserting data from visual studio, the foreign key in the Reservations table (Customer_ID) should be auto incremented and have the same value as the Primary key of the parent table Customer_Info (Customer_ID).
Should i do it via the SQL Statements in Visual Studio or it is possible to be done directly in the Database? How can i do it? Thanks
Visual Studio Windows Forms App Design:
The SQL Statement when button is clicked:
var query = "insert into Customer_info(Customer_Name,Customer_Phone) " + "values('" + name + "','" + phone + "');" + " insert into Reservations(RV_DAY,Customer_ID,Table_Arrangement,RV_OT,RV_PW,RV_SIOC) " + "values('" + day + "',50,'" + tb + "','" + SR1 + "','" + SR2 + "','" + SR3 + "');";
Visual Studio Exception error: