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 ]
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With