Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
AnswerRe: Software Process Change Best Practices Pin
Eddy Vluggen18-Jun-09 22:56
professionalEddy Vluggen18-Jun-09 22:56 
QuestionNested try/catch blocks Pin
Helfdane18-Jun-09 22:35
Helfdane18-Jun-09 22:35 
AnswerRe: Nested try/catch blocks Pin
Christian Graus18-Jun-09 22:41
protectorChristian Graus18-Jun-09 22:41 
GeneralRe: Nested try/catch blocks Pin
Helfdane18-Jun-09 22:45
Helfdane18-Jun-09 22:45 
JokeRe: Nested try/catch blocks Pin
DaveyM6918-Jun-09 22:49
professionalDaveyM6918-Jun-09 22:49 
GeneralRe: Nested try/catch blocks Pin
Helfdane18-Jun-09 22:53
Helfdane18-Jun-09 22:53 
GeneralOT Pin
Vikram A Punathambekar18-Jun-09 23:59
Vikram A Punathambekar18-Jun-09 23:59 
AnswerRe: Nested try/catch blocks Pin
Nagy Vilmos18-Jun-09 22:58
professionalNagy Vilmos18-Jun-09 22:58 
Sequencial try/catches would be better. Something like:

SqlConnection conn;
SqlTransaction trans;

try {
  conn = new SqlConnection(connectionString);
  conn.Open();
  SqlTransaction trans = conn.BeginTransaction();
}
catch (SomeTypeOfException ex) {
  // deal with exception
}
finally {
  // transaction as well??

  if (conn != null) {
    conn.Close();
    conn.Dispose();
  }
}

// if we've got a trasnaction carry on:
if (trans != null) {
  try {
    string query = "query goes here";
    SqlCommand command = new SqlCommand(query, conn, trans);
    // add parameters
    command.ExecuteNonQuery();
    trans.Commit();
  }
  catch (SomeOtherException ex) {
    // deal with exception
   trans.Rollback();
  }
  finally {
    if (conn != null) {
      conn.Close();
      conn.Dispose();
    }
  }
}




Panic, Chaos, Destruction.
My work here is done.

GeneralRe: Nested try/catch blocks Pin
Helfdane18-Jun-09 23:16
Helfdane18-Jun-09 23:16 
GeneralRe: Nested try/catch blocks Pin
Nagy Vilmos19-Jun-09 0:58
professionalNagy Vilmos19-Jun-09 0:58 
GeneralRe: Nested try/catch blocks Pin
PandemoniumPasha18-Jun-09 23:29
PandemoniumPasha18-Jun-09 23:29 
GeneralRe: Nested try/catch blocks Pin
Nagy Vilmos19-Jun-09 0:55
professionalNagy Vilmos19-Jun-09 0:55 
AnswerRe: Nested try/catch blocks Pin
PIEBALDconsult19-Jun-09 5:30
mvePIEBALDconsult19-Jun-09 5:30 
Questionto display image from listview Pin
deleepkv18-Jun-09 22:15
deleepkv18-Jun-09 22:15 
AnswerRe: to display image from listview Pin
Christian Graus18-Jun-09 22:43
protectorChristian Graus18-Jun-09 22:43 
GeneralRe: to display image from listview Pin
deleepkv18-Jun-09 23:57
deleepkv18-Jun-09 23:57 
Questionhow to Include Graph in C# windows Application Pin
Mads11518-Jun-09 20:49
Mads11518-Jun-09 20:49 
AnswerRe: how to Include Graph in C# windows Application Pin
stancrm18-Jun-09 21:03
stancrm18-Jun-09 21:03 
GeneralRe: how to Include Graph in C# windows Application Pin
Mads11518-Jun-09 21:31
Mads11518-Jun-09 21:31 
Questionis there a way to print pdf on different printers without making the alignment run out, using iReport? Pin
daffy_200318-Jun-09 20:31
daffy_200318-Jun-09 20:31 
Questionsqlbulkcopy issues Pin
havejeet18-Jun-09 20:17
havejeet18-Jun-09 20:17 
AnswerRe: sqlbulkcopy issues Pin
Mycroft Holmes18-Jun-09 22:02
professionalMycroft Holmes18-Jun-09 22:02 
QuestionHow is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Member 397434718-Jun-09 20:05
Member 397434718-Jun-09 20:05 
AnswerRe: How is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Christian Graus18-Jun-09 20:32
protectorChristian Graus18-Jun-09 20:32 
AnswerRe: How is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Vikram A Punathambekar18-Jun-09 20:34
Vikram A Punathambekar18-Jun-09 20:34 

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.