When I open a Script component, I can choose a Connection Manager from a dropdown list:
This Connection Manager has it all, if I had it as an object in the C# code, I would not need to write a hardcoded connection string anymore.
I tried it with an OLEDB provider and SQL but failed.
This is well documented on MSDN, covering both VB and C# type of scripts: http://msdn.microsoft.com/en-us/library/ms136018.aspx