How to 'delete' connection if the user can't access that db
-
- Posts: 53
- Joined: Wed Nov 27, 2013 5:24 pm
How to 'delete' connection if the user can't access that db
If we have a dictionary, with several db connections, and the user can't connect to a certain db, then the program will show him an error because of the Initial catalog of the connection string. So how can we 'delete' programatically a db connection from the dictionary, without actually having to remove it from the dictionary, but rather when the program loads?
Re: How to 'delete' connection if the user can't access that
Hello.
Sorry, maybe we did not exactly understand your question. Could you explain your issue more detailed?
Thank you.
Sorry, maybe we did not exactly understand your question. Could you explain your issue more detailed?
Thank you.
-
- Posts: 53
- Joined: Wed Nov 27, 2013 5:24 pm
Re: How to 'delete' connection if the user can't access that
Well it's there a way to 'delete' stuff from the dictionary via code? Not like edit the dictionary so it doesn't contain a certain connection anymore, just as if the user clicked on it and chose delete.
Re: How to 'delete' connection if the user can't access that
Hello.
You could use next code to remove any connection:
Thank you.
You could use next code to remove any connection:
Code: Select all
report.Dictionary.Databases.Remove(report.Dictionary.Databases["Connection"]);
-
- Posts: 53
- Joined: Wed Nov 27, 2013 5:24 pm
Re: How to 'delete' connection if the user can't access that
I tried this and when the program loads it shows a little X next to the database icon, I thought it was supposed to remove the connection?
Re: How to 'delete' connection if the user can't access that
Hello.
Thank you.
Then you should remove DataSource too with next code:theregister wrote:I tried this and when the program loads it shows a little X next to the database icon, I thought it was supposed to remove the connection?
Code: Select all
report.Dictionary.DataSources.Remove(report.Dictionary.DataSources["DataSource1"]);