By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

Changing Server/Database in Crystal Report at runtime

P: n/a
I'm trying to change the database and server on a report that was created
using integrated security e.g. report was created pointing to the server
'testserver' and database 'testdb' and at runtime i want to change the
report to connect to 'liveserver' & 'livedb'.

I'm using visual studio 2003, Crystal 10 Developer full (sp1) and c#
connecting to a sql server 2000 db using OLEDB connection and integrated
security.

I've tried the solution as per crystal support article
http://support.businessobjects.com/l...s/c2011464.asp

but as i'm not supplying a username and password this gives a sql error
28000 when applying the logoninfo. I've tried setting the password and
username as various combinations of null and empty string to no avail.

if any one can help i would be most grateful

regards

barney
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I use
protected void SetSecurityInfo(string server, UserNameAndPassword login)
{
ConnectionInfo cn = new ConnectionInfo();
cn.ServerName = server;
cn.DatabaseName = Consts.DBName;
cn.UserID = login.UserName;
cn.Password = login.PassWord;

foreach(Table t in r.Database.Tables)
{
TableLogOnInfo tl = t.LogOnInfo;
tl.ConnectionInfo = cn;
t.ApplyLogOnInfo(tl);
}
r.Refresh();
}

which works fine...
(UserNameAndPassword is a struct containing string UserName and string
Password.)

r is the report object.

"fatboy" wrote:
I'm trying to change the database and server on a report that was created
using integrated security e.g. report was created pointing to the server
'testserver' and database 'testdb' and at runtime i want to change the
report to connect to 'liveserver' & 'livedb'.

I'm using visual studio 2003, Crystal 10 Developer full (sp1) and c#
connecting to a sql server 2000 db using OLEDB connection and integrated
security.

I've tried the solution as per crystal support article
http://support.businessobjects.com/l...s/c2011464.asp

but as i'm not supplying a username and password this gives a sql error
28000 when applying the logoninfo. I've tried setting the password and
username as various combinations of null and empty string to no avail.

if any one can help i would be most grateful

regards

barney

Nov 16 '05 #2

P: n/a
I'm afraid this doesn't work as the reports were created using integrated
security and are being run using an integrated security connection.

This mean the user doesn't log into the application and no user name /
password is manually supplied.

I've have even tried supplying my details and the sql server dbm details but
neither work.
"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:35**********************************@microsof t.com...
I use
protected void SetSecurityInfo(string server, UserNameAndPassword login)
{
ConnectionInfo cn = new ConnectionInfo();
cn.ServerName = server;
cn.DatabaseName = Consts.DBName;
cn.UserID = login.UserName;
cn.Password = login.PassWord;

foreach(Table t in r.Database.Tables)
{
TableLogOnInfo tl = t.LogOnInfo;
tl.ConnectionInfo = cn;
t.ApplyLogOnInfo(tl);
}
r.Refresh();
}

which works fine...
(UserNameAndPassword is a struct containing string UserName and string
Password.)

r is the report object.

"fatboy" wrote:
I'm trying to change the database and server on a report that was created
using integrated security e.g. report was created pointing to the server
'testserver' and database 'testdb' and at runtime i want to change the
report to connect to 'liveserver' & 'livedb'.

I'm using visual studio 2003, Crystal 10 Developer full (sp1) and c#
connecting to a sql server 2000 db using OLEDB connection and integrated
security.

I've tried the solution as per crystal support article
http://support.businessobjects.com/l...s/c2011464.asp

but as i'm not supplying a username and password this gives a sql error
28000 when applying the logoninfo. I've tried setting the password and
username as various combinations of null and empty string to no avail.

if any one can help i would be most grateful

regards

barney

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.