views:

67

answers:

0

I'm writing a small asp.net app that uses an access db. I'm using a layered architecture and business objects. In my dataaccess class, I have tis method that returns all records by UserID:

public static List<BilledeDetails> GetBillederByUserID(int userid)
        {
            using (OleDbConnection conn = new OleDbConnection(_connString))
            {
                OleDbCommand cmd = new OleDbCommand("GetBillederByUserID", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@UserID", OleDbType.Integer).Value = userid;
                conn.Open();
                OleDbDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                    return GetBilledeCollectionFromReader(reader);
                else
                    return null;
            }
        }

The problem is that the reader object is null, even though the records with the specified userid exist in the db.

I have tried using an AccessDataSource directly on the aspx page and hooking it up to a grid, and then the records are returned. Also, using my dataaccess class, I can insert new records without problems, so the connection works just fine.

I have used this model in many apps with sql server, and it allways works. So, my question is if there are any known issues when using OleDbDataReaders with asp.net? Am I using it correctly, or am I missing something?

Thnx.