vb.net - VB net and postgres : Getting "An operation is already in progress" using npgsql -
i'm using following code retrieve list of objects (products) , list (sizes) inside of them.
dim l new list(of entidades.producto) dim c new npgsqlcommand("select id, name product", cn) dim r npgsqldatareader = c.executereader while r.read dim p new entidades.product p.id = r.item("id") p.name = r.item("name") l.add(p) >>> had other loop here having same issue tried put reader outside of loop. loop r.close() each p in l c = new npgsqlcommand("select t.id id, t.name nombre productsize pt join size t on t.id = pt.sizeid productid = :productid order ord", cn) c.parameters.addwithvalue("productid", pgsqltypes.npgsqldbtype.integer, p.id) c.prepare() <---- here error dim rt npgsqldatareader = c.executereader while rt.read dim t new size t.id = rt.item("id") t.nombre = rt.item("name") p.size.add(t) loop next return l
and i'm getting "an operation in progress" error when execute prepare.
i thought closing reader enough run another.
anyone had same problem?
thanks advance
actually, found problem. second loop not closing reader, , when called function again, exploded.
thanks steve tip.
Comments
Post a Comment