Use something like this:
Regex.Replace("Tab data here....", "\\t|\\r|\\n|\\v|\\f|\\e|\\x20|\\040\\cC\\u0020", "")
Mike's a long-time, C# developer, with experience in database development, software architecture & design, .Net, ASP.NET, HTML, JavaScript, VB, CSS, Flash, SQL Server, Oracle, and more.
Tuesday, August 18, 2009
Wednesday, August 05, 2009
Settings DataSet/TableAdapter Connection Strings at Runtime
The DataSet's TableAdapter generates strongly types classes in VS.NET, with properties to connection strings that are read-only at runtime, unless, of course, you choose the "User" scope. Follow these steps for changing the connection string upon application startup:
- Open up the Settings.settings file, whatever it might be named in your project. If it's not there, create one by a) adding a new Settings file to your project, b) adding a new (Connection string) setting, c) save it, d) then ensure that each DataSet's TableAdapter's Connection property references this Settings file's (Connection string) setting.
- Press the F7 key to view its code.
- Add the following code to the Settings() constructor:
this.SettingsLoaded += new System.Configuration.SettingsLoadedEventHandler(Settings_SettingsLoaded); - Add the following method to the Settings class:
private void Settings_SettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e) { try { Settings.Default["PrizeWinsConnectionString"] = "PUT YOUR CONNECTION STRING HERE!"; } catch (System.Exception err) { throw; } } - Save and recompile your project/solution.
Subscribe to:
Posts (Atom)