简体   繁体   English

如何在CD上打包.sdf数据库应用程序并运行而不在计算机上安装

[英]How to package .sdf Database Application on CD and run without installing on machines

I am having a challenge that is specifically unique to me. 我面临的挑战是我特有的。 I have browse the questions and answers catalog and what i found does not specifically address my scenario. 我浏览了问题和答案目录,发现的内容并没有专门针对我的情况。

I created Windows Application on C#.Net with SQL Server CE at the back-end. 我在后端使用SQL Server CE在C#.Net上创建了Windows应用程序。 I want the Application to be packaged in CD in such a way that my User will not install it rather will just insert and use the Application. 我希望将应用程序打包在CD中,这样我的用户就不会安装它,而只会插入并使用该应用程序。

I have build the Application and copied the DB file, Application File, Configuration Files, Manifest Files and the .dll files to a folder and zipped it. 我已经构建了应用程序,并将数据库文件,应用程序文件,配置文件,清单文件和.dll文件复制到一个文件夹中,然后将其压缩。 Then copied the zipped folder to a CD ROM and run on a different system. 然后将压缩的文件夹复制到CD ROM并在其他系统上运行。

On the System I installed SQL Server CE Runtime installer. 在系统上,我安装了SQL Server CE Runtime安装程序。 The Application executed successfully but when I attempted to submit a Form that is connected to the .sdf database the following exception was thrown: 应用程序成功执行,但是当我尝试提交连接到.sdf数据库的表单时,引发了以下异常:

The path is not valid. 路径无效。 Check the directory for the database. 检查数据库目录。 [Path = C:\\Users\\John\\AppData\\Temp\\Temp2_App.zip\\App\\Data\\abc.sdf] [路径= C:\\ Users \\ John \\ AppData \\ Temp \\ Temp2_App.zip \\ App \\ Data \\ abc.sdf]

My Application Connection String at App.Config is: 我在App.Config上的应用程序连接字符串是:

<connectionString> 
     <add name="MyApp.Properties.Settings.MyAppConnectionString"
     connectionString="DataSource =|DataDirectory\\abc.sdf|"
     providerName="Microsoft.SqlServerCe.Client.3.5 />"
</connectionString>

The Connection Strings I used in my codes is: 我在代码中使用的连接字符串为:

string conString = "Data Source=|DataDirectory|\\Data\\abc.sdf";

Please what is it that I am getting wrong. 请告诉我我错了。 Please help me. 请帮我。

Well, in the quest to finding a solution to the problem I have modified the App.Config Connection String to: 好吧,为了寻求解决问题的方法,我将App.Config连接字符串修改为:

<connectionString> 
     <add name="MyApp.Properties.Settings.MyAppConnectionString"
     connectionString="DataSource =|DataDirectory|\\Data\\abc.sdf"
     providerName="Microsoft.SqlServerCe.Client.3.5 />"

And when I executed the Application on a user Machine it flag the exception - Access to the database file is not allowed. 当我在用户计算机上执行该应用程序时,它会标记异常-不允许访问数据库文件。 [File name = E:\\App\\Data\\abc.sdf]. [文件名= E:\\ App \\ Data \\ abc.sdf]。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不安装任何数据库服务器的情况下在本地运行桌面应用程 - How to run desktop application with database locally without installing any database Server? 使用sdf数据库(SQL Server Compact 3.5数据库文件)而不安装Microsoft sql server C# - Use sdf database(SQL Server Compact 3.5 database file) without installing Microsoft sql server C# SDF和MDF,一个应用程序中的两个数据库 - SDF and MDF, two database in one application 如何使用EF模型和SDF数据库生成数据库? - How to generate a database with the EF model and SDF database? 安装clickonce应用程序时运行脚本数据库 - Run script database when installing clickonce application 安装Windows应用程序安装程序后,sdf文件中出现只读错误 - Read only error in sdf file after installing windows application setup 如何使我的安装项目在Winform应用程序中包含数据库(.sdf)文件? - How Do I make my Setup Project Include my Database (.sdf) file along with the winform application? 如何在不安装数据库的情况下使用数据库? - How to use database without installing it? 如何连接到网络上的sdf文件数据库 - How to connect to sdf file database on network 使用 MSMQ 而不在客户端计算机上安装 MSMQ - Using MSMQ without installing MSMQ on client machines
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM