troubleshooting Question

System.Threading.ThreadAbortException oConn.Open C# MS SQL

Avatar of QuinnDester
QuinnDesterFlag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingMicrosoft SQL Server 2005C#
11 Comments1 Solution811 ViewsLast Modified:
I keep get this error System.Threading.ThreadAbortException  when the line oConn.Open executes, and the class below stops.

i have stepped through the code, var's are being passed through correctly and the conection string is being picked up correctly.

i have connected to the database using the VS database explorer to verify that VS can connect to the database, but i cant track down the cause of this problem, could someone please help me with this, thank you
public static bool newAcc(string thisUser, string thisEmail, string thisUserID)
    {
        try
        {
            using (SqlConnection oConn = new SqlConnection(connectionString))
            {
                oConn.Open();
                using (SqlCommand oComm = oConn.CreateCommand())
                {


                  
                    

                    oComm.Parameters.Clear();
                    oComm.CommandType = CommandType.StoredProcedure;
                    oComm.Parameters.AddWithValue("@thisUser", thisUser);
                    oComm.Parameters.AddWithValue("@thisEmail", thisEmail);
                    oComm.Parameters.AddWithValue("@thisUserID", thisUserID);
                    oComm.Parameters.AddWithValue("@datetime", DateTime.Now.ToUniversalTime());

                    oComm.CommandText = "newUser";
                    oComm.ExecuteNonQuery();
                }

            }
            return true;
        }
        catch { return false; }
    }

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros