Click here to Skip to main content
15,904,351 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionPrinting in .net Pin
vijay_833-May-07 1:00
vijay_833-May-07 1:00 
AnswerRe: Printing in .net Pin
Guffa3-May-07 1:15
Guffa3-May-07 1:15 
QuestionSearch in by using a combobox Pin
Stormint3-May-07 0:44
Stormint3-May-07 0:44 
AnswerRe: Search in by using a combobox Pin
_mubashir3-May-07 2:54
_mubashir3-May-07 2:54 
AnswerRe: Search in by using a combobox Pin
Mahesh Kulkarni3-May-07 3:09
Mahesh Kulkarni3-May-07 3:09 
QuestionDisabling few items in a dropdownlist Pin
gauthee3-May-07 0:16
gauthee3-May-07 0:16 
AnswerRe: Disabling few items in a dropdownlist Pin
_mubashir3-May-07 2:57
_mubashir3-May-07 2:57 
QuestionFinding difficulty in using SqlTransaction [modified] Pin
kinnuP3-May-07 0:01
kinnuP3-May-07 0:01 
hi all ,

problem as follows ,
i am using method called
public void ExecuteNonQuery(string sql) inside Database Class .functionality of this method is takes the sql query and execute by using sqlcommand class here each method for example AddSubscriber() method is for inserting values into Subscriber table and AddSubscriberLogin() this is for inserting values into Subscribelogin Table and we have a link table called Subscribrsubscribelogin()
wihich containes both Subscriber and Suscriberlogin Id's so Due to Some problem like internet the values are not stored into SubscriberSubscriberlogintable so clint canot see all logins of Subscribers i got an idea of using sqltransactions i used as follows


Code:

in subscriber class
class Subscriber
{
AddSubscriber()
{
string sql="";//insert query
ExecuteNonQuery(sql);
}

but this code is not working. i need like to add All methods like AddSubscribeLogin() And AddSubscriSubscribeLogin() After that only i have to Commit other wise rollback all table values.
}
public void ExecuteNonQuery(string sql)
{
SqlConnection connection = new SqlConnection(databaseConnection);
try
{

connection.Open();
transaction=connection.BeginTransaction();
SqlCommand command = new SqlCommand(sql, connection);
command.Transaction=transaction;
command.ExecuteNonQuery();
transaction.Commit();
}
catch(Exception ex)
{
transaction.Rollback();
}
finally
{
connection.Close();
}
}

but when i am calling in each method it is commit always can u suggest any solution please .


Thanks And Regards,
Kinnu


-- modified at 6:51 Thursday 3rd May, 2007
QuestionInsert,Update and Delete to custom Database in VS.NET2005 Pin
mhadhia2-May-07 23:58
mhadhia2-May-07 23:58 
QuestionOpening a file in its own program?? Pin
Nada Adel2-May-07 23:37
Nada Adel2-May-07 23:37 
AnswerRe: Opening a file in its own program?? Pin
kubben3-May-07 2:57
kubben3-May-07 2:57 
QuestionTesting Tool Pin
jayarajmrj2-May-07 23:25
jayarajmrj2-May-07 23:25 
AnswerRe: Testing Tool Pin
Sathesh Sakthivel2-May-07 23:30
Sathesh Sakthivel2-May-07 23:30 
GeneralRe: Testing Tool Pin
Brady Kelly2-May-07 23:55
Brady Kelly2-May-07 23:55 
AnswerRe: Testing Tool Pin
Sandeep Akhare2-May-07 23:40
Sandeep Akhare2-May-07 23:40 
GeneralRe: Testing Tool Pin
jayarajmrj3-May-07 1:06
jayarajmrj3-May-07 1:06 
GeneralRe: Testing Tool Pin
N a v a n e e t h3-May-07 3:25
N a v a n e e t h3-May-07 3:25 
AnswerRe: Testing Tool Pin
firozu3-May-07 0:12
firozu3-May-07 0:12 
QuestionSession State Pin
Senthil_M2-May-07 23:24
Senthil_M2-May-07 23:24 
AnswerRe: Session State Pin
kubben3-May-07 2:56
kubben3-May-07 2:56 
Questionloosing data between postbacks [modified] Pin
Ayman Mashal2-May-07 22:25
Ayman Mashal2-May-07 22:25 
AnswerRe: loosing data between postbacks Pin
kubben3-May-07 2:54
kubben3-May-07 2:54 
GeneralRe: loosing data between postbacks Pin
Ayman Mashal5-May-07 18:56
Ayman Mashal5-May-07 18:56 
GeneralRe: loosing data between postbacks Pin
kubben6-May-07 1:02
kubben6-May-07 1:02 
QuestionDreamWeaver Dream Pin
matjame2-May-07 22:05
matjame2-May-07 22:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.