Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to Connect to Crystal Reports 2008

I'm exporting a crystal report 2008 to pdf in C#.

The crystal report is connected to sql server 2008 using odbc.

I want to deploy this in a different system. it works if the db name is the same.

Is there a way to supply the db name dynamically. I tried

repDoc.SetDatabaseLogon(db_username, db_password,server,db);

and it fails with the error below

    Logon failed.
Details:  [Database Vendor Code: 18456 ]Database Connector Error: ' [Database Vendor Code: 18456 ]'Failed to open the connection.
Details:  [Database Vendor Code: 18456 ]Error in File denial_completed_letters {84E1BDEF-C60B-46E1-9080-77F699692270}.rpt:
Unable to connect: incorrect log on parameters.
Details:  [Database Vendor Code: 18456 ] 
like image 432
Vivek Chandraprakash Avatar asked Dec 05 '25 01:12

Vivek Chandraprakash


1 Answers

Good news / bad news: the bad news is that you can't use SetDatabaseLogon to change the db name. The good news is that you can use another function, ApplyLogOnInfo to do that:

http://msdn.microsoft.com/en-us/library/cc411352(v=VS.90).aspx http://msdn.microsoft.com/en-us/library/ms226184(v=VS.90).aspx

Just get the logon info from the Table.LogOnInfo constructor, change the values, and call ApplyLogOnInfo.

like image 92
Chris B. Behrens Avatar answered Dec 07 '25 15:12

Chris B. Behrens



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!