水晶报告运行时登录提示....

水晶报告运行时登录提示....

问题描述:

我有一个没有任何用户名和密码的数据库

但是运行时水晶报告提示输入用户名和密码..

I have a database without any username & password
but while runtime crystal report prompt enter username & password..

你需要在运行时应用登录详细信息,请查看

C#Crystal Reports动态登录参数 [ ^ ]



编辑

--------- ----

使用SQL Server身份验证和Windows身份验证的SAP Crystal Report [ ^ ]
You need to apply the logon details at runtime, check it out
C# Crystal Reports Dynamic Logon parameters[^]

EDIT
-------------
SAP Crystal Report using SQL Server Authentication and Windows Authentication[^]


你好,

试试这个



Hello ,
Try this

CrystalReport cr = new CrystalReport();
--call the crystall report

DataSet ds1 = new DataSet();
SqlConnection myCon;
SqlDataAdapter myAdapter;

myCon = new SqlConnection("Data Source=.;Initial Catalog=dbs;
Persist Security Info=True;");

SqlCommand cmd = new SqlCommand("select * from tbl", myCon);

myAdapter = new SqlDataAdapter(cmd);
myAdapter.Fill(ds1);
-- Fill the dataset
if (ds1.Tables[0].Rows.Count > 0)
{

    cr.SetDataSource(ds1.Tables[0]);
   --here set the crytal report DataSource to  DataTable
    crystalReportViewer1.ReportSource = cr;
    crystalReportViewer1.Refresh();
}





谢谢



thanks


eassy和简单的解决方案....

open field explorer --->数据库字段--->右键单击 - >当前数据源--->报告连接----->报告----->属性---->设置属性为---



数据来源:.\Databasename.accdb



和代码观众形式加载为



Dim cryRpt As New ReportDocument



Dim Report1 As new rptItemWise



Dim strServerName As String

strServerName = Application.StartupPath

rptItemWise.SetDatabaseLogon(admin,,strServerName, dastabasename.accdb,真实的)







cryRpt.Load(Application.StartupPath +\\ \\ rptItemWise.rpt)



也改变了与数据源相同的报告连接我认为该代码适合你..
eassy and simple solution for all ....
open field explorer---> database field --->Right Click -->current Data source --->reports connection----->report ----->property ----> set Property as---

Data Source: .\Databasename.accdb

and code on viewer form load as

Dim cryRpt As New ReportDocument

Dim Report1 As New rptItemWise

Dim strServerName As String
strServerName = Application.StartupPath
rptItemWise.SetDatabaseLogon("admin", "", strServerName, "dastabasename.accdb", True)



cryRpt.Load(Application.StartupPath + "\rptItemWise.rpt")

also change the report connection same as data source i think that code work for you ..