BIG PROBLEM! Debugger hanging on sql server code debugging

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • n_o_s_p_a__m

    #1

    BIG PROBLEM! Debugger hanging on sql server code debugging

    Ok, while debugging, when I use f10 or f11 to step in, the debugger
    stops working.

    It just hangs indefinitely, no matter which line I f10 or f11 on (as
    below). This is a BIG PROBLEM, and it is specific to debugging code
    blocks where sql server connections/commands/data adapter are used,
    but nowhere else.

    After the hang, I have to restart VS.net (version 2003), but then,
    when I try to build, it says "file could not be copied to output
    directory because another process is using the file"

    Any clues?

    /********* example ************/

    using System.Data;
    using System.Data.Sql Client;

    // in a class somewhere:
    using (SqlCommand sco = new SqlCommand()) {
    sco.CommandText = procName;
    using (SqlConnection sconn = new SqlConnection() ) {
    sconn.Connectio nString =
    ConfigurationSe ttings.AppSetti ngs["ConnectionStri ng"];
    sco.Connection = sconn;
    sco.CommandType = CommandType.Sto redProcedure;

    sco.Parameters. Add(new SqlParameter("@ numRecords",
    SqlDbType.Int)) ;
    sco.Parameters["@numRecord s"].Direction =
    ParameterDirect ion.Input;
    sco.Parameters["@numRecord s"].Value = queueBatchSize;

    sco.Parameters. Add(new SqlParameter("@ threadName",
    SqlDbType.VarCh ar));
    sco.Parameters["@threadNam e"].Direction =
    ParameterDirect ion.Input;
    sco.Parameters["@threadNam e"].Value = Thread.CurrentT hread.Name;

    sco.Parameters. Add(new SqlParameter("@ state", SqlDbType.Char) );
    sco.Parameters["@state"].Direction = ParameterDirect ion.Input;
    sco.Parameters["@state"].Value = (int)state;

    using(SqlDataAd apter sda = new SqlDataAdapter( sco)) {
    using(DataSet d = new DataSet()) {
    try {
    sda.Fill(d);
    foreach (DataRow dr in d.Tables[0].Rows) {
    // do work
    }
    } catch (Exception exp) {
    Trace.WriteLine ("Exception: " + exp.Message + " Thrown
    by " + GetType().ToStr ing());
    }
    }
    }
    }
    }
Working...