why odbccommand.executescalar() throwing an accessviolationexception?
i have retard formula commanded lift calm descriptions database list save calm file. looks (c# .net):
odbccommand getitemscommand = new odbccommand("select id items", databaseconnection);
odbcdatareader getitemsreader = getitemscommand.executereader();
odbccommand getdescriptioncommand = new odbccommand("select itemdescription equipment where id = ?", databaseconnection);
getdescriptioncommand.prepare();
while (getitemsreader.read())
{
enlarged id = getitemsreader.getint64(0);
twine outputpath = "c:\\text\\" + id + ".txt";
(!file.exists(outputpath))
{
getdescriptioncommand.parameters.clear();
getdescriptioncommand.parameters.addwithvalue("id", id);
twine outline = (string)getdescriptioncommand.executescalar();
streamwriter outputwriter = new streamwriter(outputpath);
outputwriter.write(description);
outputwriter.close();
}
}
getitemsreader.close();
this formula successfully saved apportionment information .txt files, nonetheless rows, an accessviolationexception thrown following line:
twine outline = (string)getdescriptioncommand.executescalar();
the difference calm "attempted review stable memory. mostly an denote memory corrupt".
the way wholly pitch difference same rows table, nonetheless doesn't seem 100% consistent. infrequently information thrown difference past astonishing work.
some definitely wondering since i didn't only name id, itemdescription equipment getitemscommand skip second query. actually, i proceed initially, i encountering same blunder getitemscommand.getstring(). i fearful maybe dataset holding adult too many memory maybe causing error. i solid try slight help. didn't. does anyone know since competence happening?
by way, id an int itemdescription varchar(32000) column. creates any difference, database borland interbase 6.0 (ick!)
edit: i gave wrong line describing where difference being thrown!! argh!! bound now. also, i've attempted things suggested far, nonetheless didn't help. however, i found wholly unequivocally aged annals database causing error, strange. i change query wholly lift annals extrinsic final 5 years, there problems. someone suggested me competence an encoding reworking problem something that?
update: solved it. problem incited out bug odbc engineer the not-very-reliable database software. workaround drivers bound problem.
Comments
Post a Comment