经典ASP ADO.PARAMETER映射到Oracle 10g NUMBER数据类型 [英] Classic ASP ADO.PARAMETER Mapping to Oracle 10g NUMBER datatype

查看:75
本文介绍了经典ASP ADO.PARAMETER映射到Oracle 10g NUMBER数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Oracle 10g数据库,其字段定义为NUMBER.我正在将经典的ASP(vbscript)从内联sql转换为参数化.我无法使ADO.PARAMETER映射到NUMBER.我得到的只是参数对象定义不正确.提供了不一致或不完整的信息."我试过了十进制,数字,精度和小数位数,int,bigint,varchar,大小以及我能想到的所有组合.

I have an Oracle 10g database with a field defined as NUMBER. I am converting a classic ASP (vbscript) from inline sql to parameterized. I cannot get the ADO.PARAMETER to map to a NUMBER. All I get is "Parameter object is improperly defined. Inconsistent or incomplete information was provided." I've tried decimal, numeric, with precision and scale, int, bigint, varchar, sizes and everything combination I can think of.

Dim param
Set param = Server.CreateObject("ADODB.Parameter")
param.Type = ? ' adDecimal
param.Precision = ? ' 38
param.NumericScale = ? ' 0
param.size = ?
.Value = MYNUMBER

有人可以告诉我我需要的类型,精度,比例,大小等吗?

Can someone tell me the type, precision, scale, size etc that I need?

推荐答案

我会考虑使用ADODB.Command对象的CreateParameter()方法正确构建参数.可能不是您要传递的数据类型或精度等问题,而是缺少未设置Parameter对象的属性(例如Direction)或未定义命名常量.

I would consider using the CreateParameter() method of the ADODB.Command object to build the parameters correctly. It's likely not the data type you are passing or the precision etc. that is the problem, rather it will be missing properties of the Parameter object not being set (such as Direction for example) or the Named Constants are not defined.

考虑到这个特定示例,我根据

With that in mind for this particular example I looked up the expected data type Named Constant for Oracle's NUMBER data type and according to Carl Prothman - Data Type Mapping (an excellent resource for mapping ADO constants to various data sources) you should be using adNumeric which is 131. Armed with that information I would build the parameter like so;

<%
Dim cmd: Set cmd = Server.CreateObject("ADODB.Command")
With cmd
  ...
  'Define parameters
  Call .Parameter.Append(.CreateParameter("par1", adNumeric, adParamInput, 9))
  ...
  'Set Parameter values
  .Parameter("par1").Value = MYNUMBER
  ...
End With
%>

... -表示用于构建ADODB.Command对象的假定代码.

... - denotes assumed code for building the ADODB.Command object.

  • A: ADODB.Parameters error '800a0e7c' Parameter object is improperly defined. Inconsistent or incomplete information was provided (in case the cause is you don't have the named constants defined).
  • A: How to use ASP variables in SQL statement (more complete example of using the ADODB.Command object).

这篇关于经典ASP ADO.PARAMETER映射到Oracle 10g NUMBER数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆