Avatar of QuinnDester
QuinnDester
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

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

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

.NET ProgrammingMicrosoft SQL Server 2005C#

Avatar of undefined
Last Comment
QuinnDester

8/22/2022 - Mon