覆盖连接字符串 [英] overriding the connection string

查看:84
本文介绍了覆盖连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

emp数据库(连接字符串vsspl-005 \ sqlexpress)员工数据库(连接字符串vsspl-002 \ sqlexpress)
运行时员工数据库
当我给打印按钮emp数据库



上面的4个图显示了问题.

请帮助我,最近四天我一直在努力!
我有一个使用数据库专家连接到数据库的水晶报表,连接字符串为vsspl-005 \ sqlexpress,我想将连接字符串覆盖为vsspl-002 \ sqlexpress.

我已经在webconfig文件中写入了连接字符串,效果很好.

例如,使用数据库专家将报告连接到emp数据库,并将覆盖字符串连接到webconfig文件中的employee数据库.

运行时,它显示正确的员工数据库,但是当我打印时,它显示登录提示,服务器名称与vsspl-005 emp数据库相同.
在pdf中,它正在打印eml数据库,但我希望在pdf中并打印出employee数据库.

请帮帮我.

我想在运行时以及在pdf中给print命令时都覆盖连接字符串.

emp database(connection string vsspl-005\sqlexpress)employee database(connection string vsspl-002\sqlexpress)
runtime employee database
when i give print button emp database



The above 4 fig displays the problem.

Please help me, I have been trying for the last four days!
I''ve one crystal report which is connected to the database using database expert and connection string is vsspl-005\sqlexpress and I want to override the connection string to vsspl-002\sqlexpress.

I''ve writen the connection string in webconfig file it is working well.

For example, the report is connected to the emp database using database experts and the overriding string is connected to the employee database in webconfig file.

When I run it is displaying correct employee database but when I give print it is displaying the logon prompt with server name same vsspl-005 emp database.
In the pdf it is printing the eml database but I want the employee database in the pdf and print.

Please help me.

I want to override the connection string both the time while its running and when I give print command in pdf also.

Please can any one help me.

推荐答案

好..这很简单..

因此,您要做的就是使包含要覆盖的连接的方法具有关键字virtual,并使包含覆盖的连接的方法具有关键字override关键字(假设它们具有相同的方法名称).

然后只需使用所需的参数调用方法的名称,它就可以正常工作.

:)
ok..That is simple..

so what you would do is to make the method containing the connection to be overridden have the keyword virtual and the method containing the overriding connection have the keyword override keyword (assuming they have the same method names).

and then just call the name of the method with the required parameters, it should work good.

:)


这篇关于覆盖连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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