By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,667 Members | 1,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,667 IT Pros & Developers. It's quick & easy.

BIG PROBLEM! Debugger hanging on sql server code debugging

P: n/a
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 (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.SqlClient;

// in a class somewhere:
using (SqlCommand sco = new SqlCommand()) {
sco.CommandText = procName;
using (SqlConnection sconn = new SqlConnection()) {
sconn.ConnectionString =
sco.Connection = sconn;
sco.CommandType = CommandType.StoredProcedure;

sco.Parameters.Add(new SqlParameter("@numRecords",
sco.Parameters["@numRecords"].Direction =
sco.Parameters["@numRecords"].Value = queueBatchSize;

sco.Parameters.Add(new SqlParameter("@threadName",
sco.Parameters["@threadName"].Direction =
sco.Parameters["@threadName"].Value = Thread.CurrentThread.Name;

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

using(SqlDataAdapter sda = new SqlDataAdapter(sco)) {
using(DataSet d = new DataSet()) {
try {
foreach (DataRow dr in d.Tables[0].Rows) {
// do work
} catch (Exception exp) {
Trace.WriteLine("Exception: " + exp.Message + " Thrown
by " + GetType().ToString());
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.