-
sql transaction
here is the link where sql transaction is used http://www.aspnettutorials.com/tutor...on-csharp.aspx
in this line
Code:
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
RegionID is entered by user rather than auto generated ,so i have same problem but only difference is that if i have auto generated what code should i write in try block .
-
Re: sql transaction
Hey,
If you want the RegionID to be specified by the user, then you will need to created a parameterized query, and get this value from the user.
Have a look here:
http://www.4guysfromrolla.com/webtech/092601-1.shtml
For more information.
Gary
-
Re: sql transaction
no ,not specified by user see first region details enters by user and region id is created in Database automatically (auto generated primary field in table).means enter in region table and get the same record from region table in order to enter the data into another table based on the same regionid
please provide feedabck if still need description
-
Re: sql transaction
Ah, ok, I think I see what you are getting at.
You can use the Scope_Identity to get the last value entered in the table:
http://msdn.microsoft.com/en-us/library/ms190315.aspx
From there, you can use this value in the updates to the other tables.
Gary