Friday, June 27, 2008

VS 2005: Connection String Modifications in Class Libraries


An excellent practice in coding is to centralize and conseal data access code so that you do not have to reset configuration or in our case the "connection string" all over the places. You've probably experiencd that if you created a DataSet in the same project as all your main forms, connection string is in the Application's Settings file. And upon the form inialization, you can just change the connection string property then you are all set for the rest of the code.

What happens though if you placed the DataSet in a separate library. In this case you don't see the connection string any more in your Application's config file or Settings.

My Solution:

There are many different ways of doing this, from creating a factory class to overriding some config class objects that returns the correct (dynamically changed) connection string.

My solution is quite minimum compared to those but it does work and it does not require a lot of lines of code.

If you have created a Class Library on its own project then there is a namespace that is assigned to that project. If you create a DataSet in this project then it will create a local settings directory.

I usually have a database locally and so when I am developing I set my SQL hostname by default to (local) and when I go in production I just need to repoint the host name. The following code then will replace that with another hostname.

The property setting values are singletons (at least they seem to be) so if you run this once early on in your program execution, all the TableAdapters that use the connection string will take the new value from it.

namespace MyClassLib{
public class DBConnections
static public void SetDBHost(string hostName)
string cs =

cs = cs.Replace("(local)", hostName);
Properties.Settings.Default["ConnectionString"] = s; }

VS 2005: DataSet Designer Gives Unable To Find Connection Error

Symptom/ Situation:



Possible Fix:

  • Press the + icon
  • Now you should be able to modify the queries

Wednesday, June 25, 2008

Mac Tiger Does Not Autheticate When Connecting To WIndows 2003


When trying to access a file share (SMB share) from a Mac OS 10.4 (Tiger) to Windows 2003 Server which is in a Windows domain, you get a login screen, but it always fails on authentication.


The "Microsoft network server: Digitally sign communications (always)" is Enabled in the Security Options of Local Policies of Security Settings in the Default Domain Controller Security Settings.


This applies to Tiger which is running an older version of Samba software. A new version of it will not have this issue, and I have not checked that with Leopard.

Note that this may violate your general local security policy and may expose your windows server with additional security issues.
  1. From the Start Menu, open Administrative Tools
  2. Select Domain Controller Security Policy
  3. In the Default Domain Controller Security Settings applet navigate through Security Settings, Local Policies, Security Options
  4. Scroll down the list and find "Microsoft network server: Digitally sign communications (always)
  5. Disable it.
  6. From the command line tool type in "gpupdate" to load the change into the OS.

Time Took To Research and Fix This

About year and half.

Wednesday, June 11, 2008

ATT 8525 Phone Connectivity Instable





To enable the bandwidth selector tab in the Phone setup page.


And this disables it.




Tuesday, June 03, 2008

Windows DNS: nslookup works but ping does not work


You are hosting your own DNS on Windows Server 2003 or likewise. Occasionally (especially after rebooting the DNS server), hostmame lookup does not occur, for example, ping or http request to your local host(s) from a web browser.

Boodoo Answer:

I do not know why or what is happening with this and I don't have time to figure out really what's gogin on but what helps are two things,

From a command line, try typing in "ipconfig /flushdns"

If that does not work you can try the following;

  • Allow Dynamic updates on your Primary DNS nodes from the DNS configuration applet.
  • Create reverse lookup zones.