在ASP.Net 2.0中连接到Crystal Reports的本地数据库文件 [英] Connecting to Local Database file for Crystal Reports in ASP.Net 2.0

查看:59
本文介绍了在ASP.Net 2.0中连接到Crystal Reports的本地数据库文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何连接到ASP.Net中的App_Data文件夹中的Database文件以获取Crystal Reports数据库字段???

我做了一个网络项目.在其中,右键单击解决方案资源管理器中的网站名称.然后选择添加新项-SQL数据库.然后将名为Database.mdf的数据库文件添加到网站的App_Data文件夹中.

这是我在项目中使用的每个信息的数据库.
在一页上,我想生成一个报告,以便于打印该信息.为此,我在网站上添加了一个水晶报表.该报告采用一个参数,即id.基于此,数据库表中的其他数据将显示在报告中.为此,首先我们必须选择数据库专家以连接到特定数据库,以便所选表的列显示在Crystal Report的字段资源管理器"中.
但是,我没有使用数据库专家连接到Database.mdf文件的方法...
选择了Sql Server的OLE DB提供程序之后,我不知道要写什么服务器,用户名,密码,数据库名称. Web.config中提到的本地数据库文件的连接字符串为:

<add name="ConnectionString" connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" providername="System.Data.SqlClient" />

尝试使用DataSet作为数据源.但是,在将条件放在Id字段上等于传递给它的参数上时,没有显示任何字段.

解决方案

该向导很可能不会向您显示正确地执行sql server实例,因此不要从组合中选择它,而是将实例写入字段:.\SQLEXPRESS

Crystal无法附加数据库(据我所知),因此首先使用Management Studio手动将数据库附加到实例.

之后,请选中集成安全性"复选框,现在您应该可以看到附加的数据库了.使用权.这就是为什么它询问服务器名称,用户名,密码,数据库名称的原因. 您需要选择访问数据库的提供程序.

OleDB-connection-to-access-database [

Tried using DataSet as DataSource. But, no fields are being displayed on putting condition on Id field to be equal to the parameter(id) passed to it.

解决方案

Most likely the wizard wont show you correctly the sql server instance so instead of selecting it from the combo, write the instance to the field: .\SQLEXPRESS

The Crystal isn''t capable of attaching the db (as far as I know) so first manually attach the database to the instance using management studio.

After that check the integrated security check box and now you should be able to see the attached db.


The problem is that the OLE DB provider for sQL Server cannot is obviusly for SQL Server, not Access. That''s why it asks a server name, username, pwd, db name.
You need to select a provider for an access DB.

OleDB-connection-to-access-database[^]


这篇关于在ASP.Net 2.0中连接到Crystal Reports的本地数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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