如何从VB运行Access中存在的查询 [英] How to run a query that exists in Access from VB

查看:225
本文介绍了如何从VB运行Access中存在的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用谷歌搜索,但我得到了很多关于通过ADO在VB中运行

的SQL语句的回复。


我想做的一切从VB运行现有的ACCESS 2000查询,没有返回给VB的

信息。我假设我会以某种方式使用

自动化。


提前致谢。

I tried Googling this but I get a whole lot of replies about running
the SQL statement in VB via ADO.

All I want to do is run an existing ACCESS 2000 query from VB with no
information returned to VB. I am presuming that I would use
Automation somehow.

Thanks in advance.

推荐答案

嗯...你读过这本书......这次手册怎么样......

直接outta康普顿......不,等等,帮助文件:


执行方法(ADO连接)

执行指定的查询,SQL语句,存储过程或

提供程序特定的文本。


语法


对于非行返回命令字符串:


连接.Execute CommandText,RecordsAffected,Options


对于行返回命令字符串:


选项)


返回值


返回Recordset对象引用。


参数


CommandText包含SQL语句的字符串值,表格

名称,存储过程e,要执行的URL或特定于提供者的文本。


RecordsAffected可选。提供者

返回的长变量返回操作影响的记录数。


选项可选。一个Long值,指示提供程序应如何评估CommandText参数。可以是一个或多个CommandTypeEnum

或ExecuteOptionEnum值。


备注


在连接上使用Execute方法对象执行任何查询

您传递给指定的

连接上的CommandText参数中的方法。如果CommandText参数指定行返回

查询,则执行生成的任何结果都存储在新的

提供程序返回一个已关闭的Recordset对象。

Hmm... you read the book... how about the manual this time...

Straight outta Compton... no, wait, the help file:

Execute Method (ADO Connection)
Executes the specified query, SQL statement, stored procedure, or
provider-specific text.

Syntax

For a non-row-returning command string:

connection.Execute CommandText, RecordsAffected, Options

For a row-returning command string:

Set recordset = connection.Execute (CommandText, RecordsAffected,
Options)

Return Value

Returns a Recordset object reference.

Parameters

CommandText A String value that contains the SQL statement, table
name, stored procedure, a URL, or provider-specific text to execute.

RecordsAffected Optional. A Long variable to which the provider
returns the number of records that the operation affected.

Options Optional. A Long value that indicates how the provider should
evaluate the CommandText argument. Can be one or more CommandTypeEnum
or ExecuteOptionEnum values.

Remarks

Using the Execute method on a Connection object executes whatever query
you pass to the method in the CommandText argument on the specified
connection. If the CommandText argument specifies a row-returning
query, any results that the execution generates are stored in a new
Recordset object. If the command is not a row-returning query, the
provider returns a closed Recordset object.


2005年7月9日19:08:44 -0700, pi********@hotmail.com 写道:
On 9 Jul 2005 19:08:44 -0700, pi********@hotmail.com wrote:
嗯......你读了这本书......这次手册怎么样......

直接走出康普顿......不,等等,帮助文件:

执行方法(ADO连接)
Hmm... you read the book... how about the manual this time...

Straight outta Compton... no, wait, the help file:

Execute Method (ADO Connection)




没有什么比明智的回答更糟了。也许你应该尝试阅读这个问题。


如何在VB中运行EXCESS IN ACCESS 2000的查询?


正如我在原帖中所怀疑的,它可以通过自动化

使用Access Application对象完成。


谢谢。



Nothing like an answer from a wiseguy that''s wrong. Maybe you should
try reading the question.

How do I run a query that EXISTS IN ACCESS 2000 FROM VB?

As I suspected in the original post, it can be done via Automation
using the Access Application object.

Thanks.


On Sun,2005年7月10日18:33:50 GMT,Bookreader< bo *********** @ yahoo.com>

写道:
On Sun, 10 Jul 2005 18:33:50 GMT, Bookreader <bo***********@yahoo.com>
wrote:
2005年7月9日19:08:44 -0700, pi********@hotmail.com 写道:
On 9 Jul 2005 19:08:44 -0700, pi********@hotmail.com wrote:
嗯......你读过这本书......这次手册怎么样.. 。

直接outta康普顿...不,等等,帮助文件:

执行方法(ADO连接)
Hmm... you read the book... how about the manual this time...

Straight outta Compton... no, wait, the help file:

Execute Method (ADO Connection)



没有就像一个明智的答案,这是错的。也许你应该尝试阅读这个问题。

如何在VB中运行一个EXCESS IN ACCESS 2000的查询?

正如我在原帖中所怀疑的那样,它可以通过自动化使用Access Application对象来完成。

谢谢。



Nothing like an answer from a wiseguy that''s wrong. Maybe you should
try reading the question.

How do I run a query that EXISTS IN ACCESS 2000 FROM VB?

As I suspected in the original post, it can be done via Automation
using the Access Application object.

Thanks.




好​​,现在你们两个都能感受到优于另一个,每个人都很高兴!

David



Good, now both of you can feel superior to the other and everyone is
happy!
David


这篇关于如何从VB运行Access中存在的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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