Hello
I want to do insert data into several tables. The data are connected and the tables are related to each other. So after inserting a data row into one table i want to retrieve some values from that table and insert those data into another table.
For an example the query to insert data into Survey Table is like folowing
Core.DB.DoQuery("insert into survey(id,title, detail,employerid,userid) values(@id,@title, @detail, @eid, @uid);", Core.DB.SIP("title", surveyTitle.Text), Core.DB.SIP("detail", surveyDetail.Text), Core.DB.SIP("eid", LocalHelper.UserEmployerID()), Core.DB.SIP("uid", LocalHelper.UserID()), Core.DB.SIP("id", survey))
In the above query the id is automatically generated. I want to retrieve the id value and insert it intoSurveyQuestionCategory Table in SurveyID field.
Core.DB.DoQuery("insert into surveyquestioncategory(title, detail, surveyid) values(@title, @detail, @sid)", Core.DB.SIP("title", categoryTitle.Text), Core.DB.SIP("detail", categoryDetail.Text), Core.DB.SIP("sid", Survey.ID))
how can I do it?