none
System.AccessViolationException RRS feed

  • Question

  • // This code  Multi threading will  throw  System.AccessViolationException  

    // The database connection is always throw  System.AccessViolationException    help me 

    public class DataBaseInformation
        {

           private DbProviderFactory providerFactory;

           public IDbConnection CurConnection
            {
                get
                {
                    IDbConnection connection = providerFactory.CreateConnection();
                    connection.ConnectionString = connectionString;
                    return connection;
                }
            }

           public int ExecDbCommand(IDbCommand command)
            {
                using (IDbConnection conn = this.CurConnection)
                {
                    command.Connection = conn;
                    conn.Open();  //  throw  System.AccessViolationException   
                    int result = command.ExecuteNonQuery();
                    conn.Close();
                    return result;
                }
            }

    }

    Friday, June 23, 2017 9:04 AM

Answers

All replies