插入问题 [英] Insert into problem

查看:79
本文介绍了插入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我是这个小组的新手,我正在研究我的第一个真正的VB.Net

项目。我在创建和存档数据库时遇到了麻烦。我们使用

一个Access数据库存储来自我们仪器的结果,需要

让我们的客户能够存档他们的结果并修剪

来自主数据库的归档数据。


此查询字符串在.Net中工作,连接字符串定义为

指向父数据库。

" insert into .. \ myArchive.Results select * from Results where" &

queryString


这不起作用:

" insert into" &安培; strPath& " \ myArchive.Results select * from Results

where" &安培; queryString

在这种情况下,strPath是父数据库的完整路径,与连接字符串中定义的相同。

。在这两种情况下,queryString

是相同的。我得到的错误是不完整的查询条款。但唯一的

差异是归档数据库的路径。顺便说一下,这两条路径都指向相同的数据库文件。


我真的需要能够使用父数据库的路径来设置

存档的路径。有什么想法吗?


谢谢


-

Steve Kelley

解决方案

>


此查询字符串在.Net中工作,连接字符串定义为

指向父数据库。

插入.. \ myArchive.Results select * from Results where &

queryString


这不起作用:

" insert into" &安培; strPath& " \ myArchive.Results select * from Results

" &安培; queryString

在这种情况下,strPath是父数据库的完整路径,与连接字符串中定义的相同。

。在这两种情况下,queryString都是

相同。我得到的错误是不完整的查询条款。但唯一的

差异是归档数据库的路径。顺便说一句,两条路径都指向相同的数据库文件。



只是一个猜测,但路径是否包含空格?

您可能需要在表名周围加上引号。


>


此查询字符串在.Net中工作,连接字符串定义为

指向父数据库。

插入.. \ myArchive.Results select * from Results where &

queryString


这不起作用:

" insert into" &安培; strPath& " \ myArchive.Results select * from Results

" &安培; queryString

在这种情况下,strPath是父数据库的完整路径,与连接字符串中定义的相同。

。在这两种情况下,queryString都是

相同。我得到的错误是不完整的查询条款。但唯一的

差异是归档数据库的路径。顺便说一句,两条路径都指向相同的数据库文件。



只是一个猜测,但路径是否包含空格?

您可能需要在表名周围加上引号。


史蒂夫,


我从未见过(而且我已经看过很多).Net中的Select字符串带有

其中的fysical驱动路径。

(可以在连接字符串中)。

www.connectionstrings.Com

但是也许是新闻组中的某个人。


新闻:\\microsoft.public.framework.adonet可以帮到你。


有人在这里更专业的Adonet。

(不是说这里的任何人的知识活跃起来)


Cor


Hello all. I''m new to this group and I''m working on my first real VB.Net
project. I''m having trouble creating and archive of a database. We use
an Access database to store results from our instruments and need to
give our customers the ability to archive their results and prune the
archived data from the main database.

This query string works in .Net with the connection string defined to
point to the parent database.
"insert into ..\myArchive.Results select * from Results where " &
queryString

This does not work:
"insert into " & strPath & "\myArchive.Results select * from Results
where " & queryString

In this case strPath is the full path to the parent database and is the
same as is defined in the connection string. In both cases queryString
is the same. The error I get is "Incomplete query clause" but the only
difference is the path to the archive database. BTW, both paths point to
the same database file.

I really need to be able to use the path to the parent database to set
the path to the archive. Any ideas?

Thanks

--
Steve Kelley

解决方案

>

This query string works in .Net with the connection string defined to
point to the parent database.
"insert into ..\myArchive.Results select * from Results where " &
queryString

This does not work:
"insert into " & strPath & "\myArchive.Results select * from Results where
" & queryString

In this case strPath is the full path to the parent database and is the
same as is defined in the connection string. In both cases queryString is
the same. The error I get is "Incomplete query clause" but the only
difference is the path to the archive database. BTW, both paths point to
the same database file.

Just a guess, but does the path contain spaces?
You may need to put quotes around the table name.


>

This query string works in .Net with the connection string defined to
point to the parent database.
"insert into ..\myArchive.Results select * from Results where " &
queryString

This does not work:
"insert into " & strPath & "\myArchive.Results select * from Results where
" & queryString

In this case strPath is the full path to the parent database and is the
same as is defined in the connection string. In both cases queryString is
the same. The error I get is "Incomplete query clause" but the only
difference is the path to the archive database. BTW, both paths point to
the same database file.

Just a guess, but does the path contain spaces?
You may need to put quotes around the table name.


Steve,

I have never seen (and I have seen a lot) a Select string in .Net with a
fysical drive path in it.
(That can be in a connection string).

www.connectionstrings.Com
However maybe somebody in the newsgroup.

news:\\microsoft.public.framework.adonet can help you.

There are people more specialized in Adonet then here.
(Not saying about that knowledge of anybody here active)

Cor


这篇关于插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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