如何使用快速数据库文件(.mdf)进行水晶报告? [英] How can i use express database file(.mdf) for crystal report?
问题描述
我有一个数据库文件employee.mdf和sql server仅表达.
我必须用于ConnectionInfo类的凭据是什么,我没有用户名和密码
我的连接字符串是:
I have a database file employee.mdf and sql server express only.
What are the credentials i have to use for ConnectionInfo class and i do not have user id and password
My connection string is:
ConnectionString: "Data Source= .\\SQLExpress; AttachDbFilename=E:\\employee_Data.mdf; Database=employee; Trusted_Connection=Yes;connectionInfo.IntegratedSecurity = true;";
对于登录数据库,以下代码位于报告类中:
And for logon to the database the below code is in the report class:
connectionInfo.ServerName = @".\SQLEXPRESS";
connectionInfo.DatabaseName = @"E:\employee_Data.mdf";
但是在运行报告时,它会询问用户名和密码!
我已经通过安装程序部署了我的项目(Sql express和所有先决条件),并且我无法在deploym时间内在sqlexpress中创建用户.
请帮助我.
But when run the report it is asking the user id and password!
I''ve deployed my project(Sql express and all prerequirements) with a setup and i can''t create a user in sqlexpress in the deploym time.
Please help me.
推荐答案
在创建报告时尝试在代码中执行以下操作:
Try doing this in your code while creating report:
myCrystalReprot.SetDatabaseLogon("myUsername", "myPassword");
此外,请查看以下帮助信息:
C#Crystal Reports动态登录参数 [ Crystal Reports在加载时要求输入用户名和密码 [主题:每次询问用户名密码 [
Further, see if these help:
C# Crystal Reports Dynamic Logon parameters [^]
Crystal Reports asks for Username and Password while loading[^]
Topic: asking every time username password[^]
这篇关于如何使用快速数据库文件(.mdf)进行水晶报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!