I have 2 set of data's like Master and Details. I Stored both details separately in two tables eg Table1 & Table2. I have query to insert data's into Table1 and then want to get UniqueId
from Table1 and then using that UniqueId
Table2 is get stored.
Example
INSERT INTO Table1(TempId, Name, Address, Language) VALUES (1, "XYZ", "ABCD", "English");
//Now Table is like this
UniqueId TempId Name Address Language
1 1 Ram 3rd Street Hindi
2 2 Paul 1st Street Hindi
3 1 XYZ ABCD English
Here UniqueId is Primary Key Auto Increment. After storing Table1, I get UniqueId
using TempId & Language. Then insert data's into Table2.
int id=UniqueId; // This value comes from MS Access Database
INSERT INTO Table2(UniqueId, Detail1, Details2, Detail3) VALUES (id, "Det1", "Det2", "Det3");
This is my task. Now problem is I have code to get UniqueId that part didn't work, Stores Table1 and then directly stores Tables2. When I open Table2 in Access Database UniqueId set to zero.
If I use break point to check the errors, now line by line execute and it retrieve UniqueId from Table1 after it stores and then all data's stored in Table2 successfully. What is problem here ? While storing we cont able to get data? If I use break point it will works fine why? Help me if possible.
UniqueId
is Auto Increment Primary key in Table1 It generate if we store a new row into Table1.
INSERT INTO Table1()VALUES()....
thn i have code to get UniqueId SELECT UniqueId FROM Table1 WHERE MyCondition.....
INSERT INTO Table2(Id,...)VALUES(id,...)....