操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
来源:互联网 发布:视频转码用什么软件 编辑:程序博客网 时间:2024/06/04 23:49
通过使用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");
- 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
- 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
- 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
- struts+hibernate上传图片保存到oracle的blob字段
- JDBC上传图片文件到MySQL数据库的blob字段
- c# winform 操作oracle数据库的Blob字段,把图片存储到数据库,保存图片到数据库
- Kettle 生成的XML格式数据保存到Oracle 数据库的BLOB类型字段中
- 如何通过struts以oci协议将文件上传到oracle数据库的blob字段
- 对oracle数据库中的blob字段的文件下载操作时,出现null异常。
- 使用JDBC操作基于Oracle的CLOB,BLOB字段类型
- Oracle数据库中插入图片BLOB字段的方法
- Oracle数据库BLOB字段操作
- Oracle数据库BLOB字段操作
- Oracle数据库BLOB字段操作
- python上传下载BLOB类型的数据到oracle数据库
- oracle数据库日期字段类型的操作
- Oracle中BLOB字段的操作
- 用hibernate操作oracle的blob字段
- struct和class
- 简单的XML操作:XML文件创建
- C#2.0的特性
- 写给初学 MS SQL 的朋友
- 如何防止同一帐户重复登录系统
- 操作Oracle数据库实现上传图片到Blob类型的字段出现的问题
- 附录A 1. Direct3D对象
- 附录A 2. Direct3D的设备
- 中国的神仙表
- J2EE学习笔记(6) Struts HTML Tags
- 确保 ASP.NET 应用程序和 Web Services 的安全
- 附录A 3. Direct3D的资源
- B/S系统中刷屏后定位到对象
- 附录A 4. Direct3D的着色