导入SQL语句 [英] import SQL statements

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

问题描述

我是Access新手,需要从

Web应用程序更新Access数据库。我需要添加新记录并更新现有的




我想做的是让我的网络应用创建一个文本文件使用

访问SQL INSERT / UPDATE语句并获取导入权限和

执行此文件。


这可能吗?


谢谢,

凯文

解决方案

< kl ***@solomon.ie>在消息中写道

news:11 ********************** @ g43g2000cwa.googlegr oups.com ...

我是一个Access新手,需要从
Web应用程序更新Access数据库。我需要添加新记录并更新现有的记录。

我想做的是让我的网络应用程序创建一个带有访问SQL INSERT的文本文件/ UPDATE语句并获取导入和执行此文件的权限。

这可能吗?

谢谢,
Kevin



因为这将是一个Web应用程序,那么你根本就不使用MS Access - 你

只使用Access使用的相同文件格式(mdb)。你不是说

你用来构建应用程序的是什么,但ASP是使用''Access数据库''

的常见选择,但无论你是什么使用,你这个

新闻组可能不是最合适的。

无论如何,它听起来不像中间文本文件会带来任何

福利。例如,在ASP中,您编写的代码直接生成并执行

sql语句。如果你真的只是刚刚开始使用

这个,我的建议就是从简单开始。例如创建一个数据库

一个表和两三列例如

tblPerson:PsnID(自动编号),PsnFirstName,PsnLastName

开始于创建Web表单以将新人添加到数据库。这是一个非常简单的开始,但你可能会发现它需要的时间比你预期的要长。


< blockquote>


网络应用程序完全独立于Access d / b - 它将生成

更新文件,用户只需下载它到他们当地的PC

可以访问它。很抱歉没有说清楚。使用PHP / MySQL的网络应用程序是



我需要向Access添加记录,这应该很简单,但也要更新

预先加载了访问中的记录。


所以,我想我可以让我的网络应用程序创建一个文件和SQL语句

如:


插入mytable值(a,b等)

update mytable set col_a =" c"其中id = 3


(显然不正确的访问语法,但你明白了)


然后让用户在用户访问后读取文件下载它,并且

在其中运行SQL。


可以这样做吗?

< KL *** @ solomon.ie>在消息中写道

news:11 ********************* @ g43g2000cwa.googlegro ups.com ...



网络应用程序完全独立于Access d / b - 它将生成更新文件,用户只需将其下载到本地PC
可以访问它。很抱歉没有说清楚。这个网络应用程序是用PHP / MySQL编写的。

我需要在Access中添加记录,这应该很简单,但也可以在访问时更新预先加载的记录。

所以,我想我可以让我的网络应用程序创建一个文件SQL语句,例如:

插入mytable值(a,b,等)
更新mytable set col_a =" c"其中id = 3

(显然不正确的访问语法,但你明白了)

然后让用户下载后读取文件,
在其中运行SQL。

可以这样做吗?



好​​的 - 我明白你的意思了。是的,它可以做到 - 这就是那种事情

访问人员一直在做。但是为

创建单独的sql语句每行都太缺乏了 - 你应该把数据放在

文件中。

因为它是你的应用程序正在创建文本文件,你可以确保它的格式正确,这使得事情变得非常简单。

导入过程可以从创建文本文件的链接表开始,然后执行类似更新已存在的所有行的内容

id在数据库中匹配,然后插入其余的。尝试创建一个链接的

表到一个文本文件 - 然后你就可以将这些行视为数据库中存在



Hi, I''m an Access newbie and need to update an Access database from a
web application. I''ll need to add new records and also update existing
ones.

What I was thinking of doing is have my web app create a text file with
Access SQL INSERT/UPDATE statements and get Access to import and
execute this file.

Is this possible?

Thanks,
Kevin

解决方案

<kl***@solomon.ie> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...

Hi, I''m an Access newbie and need to update an Access database from a
web application. I''ll need to add new records and also update existing
ones.

What I was thinking of doing is have my web app create a text file with
Access SQL INSERT/UPDATE statements and get Access to import and
execute this file.

Is this possible?

Thanks,
Kevin


Since this will be a web app then you are not using MS Access at all - you
are only using the same file format (mdb) that Access uses. You don''t say
what you are using to build the application, but ASP is a common choice for
working with ''Access databases'' but whatever you are using, you this
newsgroup may not be the most appropriate.
Anyway, it doesn''t sound like an intermediate text file will bring any
benefits. In ASP for example, the code you write generates and executes the
sql statements directly. If you are really only just starting out with
this, my advice would be to start simple. For example create a database
with one table and two or three columns e.g.
tblPerson: PsnID (Autonumber), PsnFirstName, PsnLastName
Start by creating a web form to add new people to the database. It''s a
pretty simple start really, but you may find it takes you longer than you
anticipated.


Hi,

The web app is completly seperate to the Access d/b - it will generate
the update file and the user will simply download it to their local PC
which had access on it. Sorry for not making this clear. The web app is
in PHP/MySQL.

I need to add record to Access,which should be easy, but also update
previsually loaded records in access.

So, I figured I could have my web app create a fileso SQL statements
such as:

insert into mytable values ("a", "b", etc)
update mytable set col_a="c" where id=3

(obvisually incorrect Access syntax, but you get the idea)

Then have Access read the file after the user has downloaded it, and
run the SQL in it.

Can this be done?


<kl***@solomon.ie> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...

Hi,

The web app is completly seperate to the Access d/b - it will generate
the update file and the user will simply download it to their local PC
which had access on it. Sorry for not making this clear. The web app is
in PHP/MySQL.

I need to add record to Access,which should be easy, but also update
previsually loaded records in access.

So, I figured I could have my web app create a fileso SQL statements
such as:

insert into mytable values ("a", "b", etc)
update mytable set col_a="c" where id=3

(obvisually incorrect Access syntax, but you get the idea)

Then have Access read the file after the user has downloaded it, and
run the SQL in it.

Can this be done?


OK - I see what you mean. Yes it can be done - this is the sort of thing
Access people do all the time. However creating separate sql statements for
each line would be too ineficient - you should just have the data in the
file.
Since it is your app that is creating the text file you can ensure that it
is of the correct format and this makes things quite easy for you. The
import process could start by creating a linked table to the text file and
then doing something like updating all the rows where you have an existing
id match in the database and then inserting the rest. Try creating a linked
table to a text file - you will then be able to treat the rows as if they
existed in the database.


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

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