在C#项目设置过程中的数据库安装需要紧急帮助:) [英] Database installation during C# project setup urgent help required :)

查看:91
本文介绍了在C#项目设置过程中的数据库安装需要紧急帮助:)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我已经在C#GUI中创建了一个项目,并且我使用的数据库是SQL SERVER 2000,并且创建了一个名为"maso"的数据库,它包含大约7个表,并且在某些表中,我通过打开SQL SERVER 2000的IDE插入数据.我想要的是在设置过程中,即在客户端计算机上安装我的项目时,我希望同时安装maso数据库,不仅此maso包含一个管理表,我通过编写以下内容在其中插入数据的sql代码:

插入管理员值(``radix'',123);

此查询也必须同时执行,这是否可能请帮帮我

谢谢;
Radix

Hello,
I have created a project in C# GUI and database i used is SQL SERVER 2000, i have cretaed a database named "maso" and it contains around 7 tables and in some tables i am inserting data by opening the IDE of SQL SERVER 2000 now what i want is that during the set up i.e when my project is being installed at the clients computer i want the maso database to be installed at the same time not only this maso contains an admin table in which i am inserting data by writing the following piece of sql code:

insert into admin values(''radix'',123);

this query must also be executed at the same time is this possible please help me out

Thank You;
Radix

推荐答案

我不知道您要做什么.
为什么要在客户端上安装SQL Server?
必须至少有一个专用的数据库服务器,以便每个客户端都可以连接到一个公共数据库.
您只有 ONE 个客户端吗?
在这种情况下,有很多存储数据的选项.
如果只想使用SQL Server,则包括一个SQL Server CE数据库文件.创建表并将数据保存到数据库中,然后再进行发行版本构建.

希望这会有所帮助!
I don''t know what you are trying to do.
Why are you installing SQL Server on the client?
There must be a dedicated database server (at least), so that every client can connect to a common database.
Do you have only ONE client?
If this is the case, there are many option for storing data.
If you want to use SQL Server only, you include a SQL Server CE Database file. Create tables and save the data into the database before doing a release build.

Hope this helps!


使用Sql Manager Express(MS的免费实用程序),将数据库导出到脚本中,然后...

0)将脚本作为资源嵌入到适当的程序集中.

1)程序启动时,尝试连接到数据库.

2)如果不存在(SqlConnection.Open()方法抛出适当的异常),请提取程序并运行脚本来创建它.然后,从光盘中删除脚本文件.

3)重试连接
Using Sql Manager Express (free util from MS), export your database to a script, and then...

0) Embed the script as a resource in an appropriate assembly.

1) When your program starts up, try to connect to the database.

2) If it''s not there (the SqlConnection.Open() method throws an appropriate exception), have your program extract and run the script to create it. Then, delete the script file from th disc.

3) Retry the connection


也许您可以创建一个SQL Server Compact Edition数据库以随产品一起提供?您可以在安装时或预先使用一堆查询从头开始创建它,也可以使用第三方工具从基于服务器的数据库中创建CE数据库.
Perhaps you could create an SQL Server Compact Edition database to ship with your product? You can create it from scratch using a bunch of queries either at installation or in advance, or you could use a third party tool to create a CE database from your server based database.


这篇关于在C#项目设置过程中的数据库安装需要紧急帮助:)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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