欢迎光临
我们一直在努力

操作Oracle数据库实现上传图片到Blob类型的字段出现的问题-ASP教程,数据库相关

建站超值云服务器,限时71元/月

通过使用oledb操作oracle数据库,成功实现图片上传到blob类型的字段,但有时会发生ora-01036错误的问题,经查询是错误提示为illegal variable name/number,不知道有谁能详细解释illegal variable name/number的意思

oracle data provider for .net

hi

i am using odp.net (oracle data provider for .net) in my asp.net application.

i have a table in my oracle database called "equipmentgroup". when the page loads for the first time i retrieve all the records from the table to a dataset and save it to viewstate. later on any addition or modification is done in the dataset only in disconnected mode. finally,when user clicks update i call this function "update" which should do a batch update but instead it gives the following error :

"ora-01036: illegal variable name/number "

private void update()

{

oracleparameter workparam;

oracleconnection cnn = new oracleconnection("data source=neeleshr;user id=tmse; password=tmse;");

string sql = "insert into equipmentgroup (code, description, lifetime, priamrylife, grading, inflator, extensionrate, maintenancefee) values (:code, :description, :lifetime, :priamrylife, :grading, :inflator, :extensionrate, :maintenancefee)";

oraclecommand cmd = new oraclecommand(sql,cnn);

cmd.commandtype = commandtype.text;

oracledataadapter da = new oracledataadapter();

da.insertcommand = cmd;

workparam = da.insertcommand.parameters.add("code",oracletype.char,10,"code");

workparam.sourceversion = datarowversion.current;

workparam = da.insertcommand.parameters.add("description",oracletype.varchar,50,"description");

workparam.sourceversion = datarowversion.current;

workparam = da.insertcommand.parameters.add("lifetime",oracletype.number);

workparam.sourcecolumn = "lifetime";

workparam.sourceversion = datarowversion.current;

workparam = da.insertcommand.parameters.add("priamrylife",oracletype.number);

workparam.sourcecolumn = "priamrylife";

workparam.sourceversion = datarowversion.current;

workparam = da.insertcommand.parameters.add("grading",oracletype.char,10,"grading");

workparam.sourceversion = datarowversion.current;

workparam = da.insertcommand.parameters.add("inflator",oracletype.number);

workparam.sourcecolumn = "inflator";

workparam.sourceversion = datarowversion.current;

workparam = da.insertcommand.parameters.add("extensionrate",oracletype.number);

workparam.sourcecolumn = "extensionrate";

workparam.sourceversion = datarowversion.current;

workparam = da.insertcommand.parameters.add("maintenancefee",oracletype.number);

workparam.sourcecolumn = "maintenancefee";

workparam.sourceversion = datarowversion.current;

try

{

da.update(ds,"equipmentgroup");

}

catch(exception e)

{

message.text = e.message;

}

}

hi,

i think that you should add parameters with ":" included, like:

workparam =

da.insertcommand.parameters.add(":code",oracletype.char,10,"code");

oledb data provider for .net

string sql = "insert into equipmentgroup (code, description, lifetime, priamrylife, grading, inflator, extensionrate, maintenancefee) values (?, ?, ?, ?, ?, ?, ?, ?, )";

hi,

i think that you should add parameters with ":" included, like:

workparam =

da.insertcommand.parameters.add(":code",oracletype.char,10,"code");

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题-ASP教程,数据库相关
分享到: 更多 (0)

相关推荐

  • 暂无文章