Reputation: 1163
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 ]
Upvotes: 3
Views: 4430
Reputation: 11
For Windows 7, try to install your application by Run as Administrator and set the run as administrator compatibility to the exe. To set Run as Administrator compatibility to the exe right click on the exe then go to properties -> compatibility, check the Run as administrator checkbox and click OK.
Upvotes: 1
Reputation: 19
Sounds like your database server isn't configured for both NT and SQL authentication. or you can use sa user that have access over target database.
Upvotes: 1
Reputation: 6297
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.
Upvotes: 3