水晶报表无法打开连接
嘿大家好。 因此,有一个使用水晶报表和 sql Express 后端的 ac# windows 窗体,以及一个从远程 sql server 08 提取的水晶报表。当尝试从本地数据库提取时,我收到“无法打开连接”,但报告从远程连接加载正常。
一切在开发机器上运行良好,但在虚拟机上测试时却失败了。虚拟机上的数据库是使用开发数据库的(当前)备份创建的。这是连接的代码...
private void frm_cr_Visit_Load(object sender, EventArgs e)
{
this.Text = "Visit Report - Version:" + Application.ProductVersion;
Cursor.Current = Cursors.WaitCursor;
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(@"C:\Data\MRE\crVisitBySubVisitID.rpt");
cryRpt.SetDatabaseLogon("login", "password", @"localserver\sqlexpress", "DBname");
cryRpt.SetParameterValue("@VisitID", intVisitID);
cryRpt.SetParameterValue("@FullName", GlobalVariables.GlobalFullName);
crv.ReportSource = cryRpt;
crv.Refresh();
Cursor.Current = Cursors.Default;
}
程序中的所有其他数据库功能都可以工作。是什么导致了这个问题,我该如何解决它?
谢谢!
戴夫·K
hey there everyone.
so, have a c# windows form that uses crystal reports and a sql express backend and one crystal report that pulls from a remote sql server 08. when trying to pull from the local database, i get a 'failed to open connection' but the report loads fine from the remote connection.
everything works great on the development machine, it's when testing on a virtual machine it fails. the DB on the virtual was created using a (current)backup of the develoment DB. here's the code for the connection...
private void frm_cr_Visit_Load(object sender, EventArgs e)
{
this.Text = "Visit Report - Version:" + Application.ProductVersion;
Cursor.Current = Cursors.WaitCursor;
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(@"C:\Data\MRE\crVisitBySubVisitID.rpt");
cryRpt.SetDatabaseLogon("login", "password", @"localserver\sqlexpress", "DBname");
cryRpt.SetParameterValue("@VisitID", intVisitID);
cryRpt.SetParameterValue("@FullName", GlobalVariables.GlobalFullName);
crv.ReportSource = cryRpt;
crv.Refresh();
Cursor.Current = Cursors.Default;
}
all other DB functions within the program work. what causes the problem, and how do i fix it?
thanks!
dave k
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果所有其他功能都有效并且数据库详细信息相同,请检查用户的权限,因为这是连接问题的常见原因(假设身份验证明显返回该错误),还要检查 url(没有有关服务器名称的进一步信息)假设“localserver”可能应该是“localhost”,显然如果设置了 HOSTS 文件或服务器名称以便“localserver”工作,则忽略它。
If every other function works and the db details are the same, check permissions for the user as that is the usual cause of connection problems (supposing authentication returns that error obviously), also check the url as (without further information on server names) assume that "localserver" possibly should be "localhost", obviously if HOSTS file or server name is set so that "localserver" works ignore that.
发现我的问题,它与仅针对 Windows 身份验证设置的 sql 服务器有关,而不是与 sql 登录身份验证有关。
哦!
found my problem, it had to do with the sql server being set up for only windows authentication, and not that and sql login authentication.
doh!