objCommand = new SqlCommand("INSERT INTO Table1 (field1,field2,field3) VALUES (value1,value2,value3); SELECT SCOPE_IDENTITY()", objConnection);
Here "
SELECT SCOPE_IDENTITY()
" will give you Newly inserted record ID.
Now you have take this value into some variable and again fire a query by passing this variable and that table respected fields like,
string prID=objCommand.ExecuteScalar().ToString();
new SqlCommand("INSERT INTO Table2 (primaryID,field1,field2,field3) VALUES (prID,value1,value2,value3); SELECT SCOPE_IDENTITY()", objConnection);
I Hope this will help you.