one sql Transaction with two methodes in different classes

Matt1981

New member
Joined
Jan 15, 2013
Messages
1
Programming Experience
Beginner
Hello,

I'am new in VB.Net and have a problem with sql transactions.
I have two classes, one class cls_Login and the second class cls_User. In the first class i have a method create_Login()
which saves the username and the passwod. In the second class I have a methode create_User() which saves the username and user information like country, street, city and so on.

The problem is, that when a user start the registration i will call the two methods within one transaction but I did not know how can i handle this?
 
the transaction is on the database connection, at the database end. Begin the transaction then pass the connection around, keeping it open, til you have done everything you want with it

If there will be a long time delay between createlogin and createuser, ask yourself: why am I allowing such a long delay? if there SHOULD be a delay, then there shouldnt be a transaction. if this is about having a 2 page web wizard that asks for login info then user info, just store all the data in one place locally untill youre ready to create both at once

Youre either allowing a login to be created without a user, or you're not. There can be no halfway point for this black-and-white decision: choose (and then youll know whether to use a transaction or not)
 
Back
Top