使用C#连接到ASP.Net中的Crystal Reports本地数据库 [英] Connecting to Local DataBase for Crystal Reports in ASP.Net using C#

查看:98
本文介绍了使用C#连接到ASP.Net中的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中提到的本地数据库文件的连接字符串为:

How to connect to Database file in App_Data folder in ASP.Net for Crystal Reports Database Fields ???

I have made a web project. In that, right clicked the website name in the solution explorer. Then chose add new item - SQL Database. Then a database file named Database.mdf was added to the App_Data folder in the website.

This is the database that I use in the project for each and every information.
On one page, I want to generate a report so as to facilitate printing that info. For this, I have added a crystal report to the website. The report takes one parameter i.e. id. Based on that, the other data in the database''s table will be displayed in the report. For this, first we have to select the Database expert to connect to a particular database so that the columns of the selected table are displayed in the Field Explorer of the Crystal Report.
But, I am not getting the way to connect to the Database.mdf file using the Database Expert......
Have selected the OLE DB provider for Sql Server, after that, I dont know what Server, Username, Password, Database name to write. The connection string of the local database file as mentioned in Web.config is:

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




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

Plzzzzzzzzzzzzz回复...项目已完成!.......




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.

Plzzzzzzzzzzz reply...... Project on stake!.......

推荐答案

hiiiiiii
从NEW ITEM添加水晶报表后,选择使用报表向导,单击确定.在下一个窗口中
选择创建新连接,然后转到 OLE DB(ADO),然后选择用于SQL Server的Microsoft OLE DB提供程序.单击下一步,提供连接详细信息并选择数据库.单击下一步,将显示您的高级信息窗口.只需按完成.然后选择您的服务器,在该服务器上单击并选择您的数据库和表格.添加表格后,您可以在水晶报表中使用它.
对于参数字段,您可以创建一个参数字段并在Crystal报表中编辑查询....

好运
hiiiiiii
after adding crystal report from NEW ITEM,Choose Using the Report Wizard,Click OK. In next window
select CREATE NEW CONNECTION under that go to OLE DB(ADO),Then select Microsoft OLE DB Provider For SQL Server. Click next,Give your Connection Details and Choose your Database.Click next It will show u advance information window.Just press FINISH.Then choose your server ,click on that and choose your database and tables.after adding the table you can use it in your crystal report.
For parameter field you can create one parameter field and edit the query in crystal report....

GOOD LUCK


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

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