如何向VFP9.0的存储过程传递参数?(200分)

L

lps

Unregistered / Unconfirmed
GUEST, unregistred user!
测试存储过程如下 <br>PROCEDURE GETSTRU <br>LPARAMETERS fname <br>&nbsp; USE &amp;fname <br>&nbsp; COPY STRUCTURE EXTENDED TO &nbsp;&amp;fname.stru <br>&nbsp; USE <br>ENDPROC <br>在delphi中使用OLEDB方式连接数据库,用到了一个TADOConnection和一个TADOStoredProc,连接上以后,在Delphi中能列举出getstru这样的过程名,但是添加参数不能列举,如果手工添加(不论是设计时还是运行时)则在运行时产生一个OLE异常:features is not available <br>也试过使用adocommand等方法,结果都是一样的![:(!]<br><br><br>同样的方法如果使用sql server 2000则可以直接列举出参数,因此估计是ADO或者VFP方面的问题,至于问题在哪就要请教诸位了,我的测试库就只有上面一个存储过程,并无其他东西<br><br>测试VFP9.0自带的Northwind数据库也是一样的啊,打开Northwind数据库看了一下,和我的也没什么区别,另外,注意到VFP9.0 SP2文档中说明是可以传参数的,原文如下: <br>Stored Procedures in the OLE DB Provider <br>The Visual FoxPro OLE DB Provider accepts stored procedure commands in the following formats: &nbsp;<br><br>Calling a stored procedure using the conventional syntax: &nbsp;<br><br>myStoredProc( Param1, Param2, ... ) <br>&nbsp; <br><br>Calling a stored procedure using the SQL EXEC keyword with the following syntax: &nbsp;<br><br>EXEC myStoredProc( Param1, Param2, ... ) &nbsp;<br>&nbsp; <br><br>where each parameter is in the format expected for its data type or is a valid expression that returns that format as in the following example: &nbsp;<br><br>EXEC myStoredProc( 'characterparm', {^2002/09/09}, dateTime(), 100, 99.99, .T.) <br>&nbsp; <br>Note &nbsp; <br>Be sure to replace myStoredProc with the name of the stored procedure you want. &nbsp;<br>&nbsp; <br>Tip &nbsp; <br>When you are using ADO or ADO.NET and setting the Command Type to Stored Procedure, you do not need to include the EXEC keyword. If the Command Type is not set to Stored Procedure, you must use the conventional syntaxfor stored procedures or use the EXEC keyword. <br>&nbsp; <br><br><br>Registry Entries <br>When you install the Visual FoxPro OLE DB Provider, the installation program updates your system registry, HKEY CLASSES_ROOT, and adds the following new keys: <br><br>HKEY_CLASSES_ROOT/VFPOLEDB <br><br>HKEY_CLASSES_ROOT/VFPOLEDB.1 <br><br>HKEY_CLASSES_ROOT/Vfpoledb.ConnectionPage <br><br>HKEY_CLASSES_ROOT/Vfpoledb.ConnectionPage.1 <br><br>HKEY_CLASSES_ROOT/VFPOLEDB.ErrorLookup <br><br>HKEY_CLASSES_ROOT/VFPOLEDB.ErrorLookup.1 <br><br>International Support <br>The Visual FoxPro OLE DB Provider provides international language support for the following: &nbsp;<br><br>Double-byte character sets (DBCS) <br><br>Multiple collating sequences &nbsp;<br><br>A collating sequence defines the sort order for data stored in a Visual FoxPro table or database. The Visual FoxPro OLE DB Provider is configured to use collating sequences that support the language version of your operating system by default. <br><br>有一个好人翻译的如下: <br>OLE DB 提供程序 中的存储过程 <br>Visual FoxPro OLE DB 提供程序接受下列格式的存储过程命令: <br><br>使用常规语法调用存储过程: <br>myStoredProc( Param1, Param2, ... ) <br>&nbsp; <br><br>使用带有下列语法的 SQL EXEC 关键字调用存储过程: <br>EXEC myStoredProc( Param1, Param2, ... ) &nbsp;<br>&nbsp; <br>这里的每个参数是象下列示例中数据类型所期望的格式或是返回该格式的有效表达式: <br>EXEC myStoredProc( 'characterparm', {^2002/09/09}, dateTime(), 100, 99.99, .T.) <br>&nbsp; <br>注意: &nbsp;<br>确定使用想要的存储过程名替换了 myStoredProc。 &nbsp;<br>  &nbsp;<br>提示: &nbsp;<br>当使用 ADO 或 ADO.NET 并设置命令类型(Command Type)为存储过程(Stored Procedure)时,不需要包含 EXEC 关键字。如果命令类型(Command Type)没设置为存储过程(Stored Procedure),必须使用存储过程的常规语法或使用 EXEC 关键字。 &nbsp;<br>  &nbsp;<br><br><br>注册项目 <br>当安装 Visual FoxPro OLE DB 提供程序时,安装程序更新系统注册表 HKEY CLASSES_ROOT 并添加下列新键: <br><br>HKEY_CLASSES_ROOT/VFPOLEDB <br><br>HKEY_CLASSES_ROOT/VFPOLEDB.1 <br><br>HKEY_CLASSES_ROOT/Vfpoledb.ConnectionPage <br><br>HKEY_CLASSES_ROOT/Vfpoledb.ConnectionPage.1 <br><br>HKEY_CLASSES_ROOT/VFPOLEDB.ErrorLookup <br><br>HKEY_CLASSES_ROOT/VFPOLEDB.ErrorLookup.1 <br><br>国际化支持 <br>Visual FoxPro OLE DB 提供程序提供下列国际化语言支持: <br><br>双字节字符集(DBCS) <br><br>多重排序序列 <br>排序序列定义了存储在 Visual FoxPro 表或数据库中数据的排列顺序。Visual FoxPro OLE DB 提供程序被默认设置为使用操作系统语言版本所支持的排序序列。
 
怎么还有人用vfp啊,
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
724
import
I
S
回复
0
查看
828
SUNSTONE的Delphi笔记
S
顶部