Hi,
I am using VS.NET 2003 and C#. I am trying to create a SqlConnection by reading in the connection string from a text file. But this does not seem to work. I would really appreciate some help as to how I can accomplish this task. Here is my example code:
FileStream fs = new FileStream(@"C:\connPath.txt" , FileMode.Open, FileAccess.Read);
StreamReader m_streamReader = new StreamReader(fs);
path = m_streamReader.ReadLine();
SqlConnection sqlConn = new SqlConnection(path);
******* If I use the following it works just fine:
path = "data source = Saloo\\VSdotNET;database=Test_DB;trusted_connection=yes";
SqlConnection sqlConn = new SqlConnection(path);
*******
I have no clue at this moment as to how to fix this problem. I would really appreciate some help.
Thanks
I am using VS.NET 2003 and C#. I am trying to create a SqlConnection by reading in the connection string from a text file. But this does not seem to work. I would really appreciate some help as to how I can accomplish this task. Here is my example code:
FileStream fs = new FileStream(@"C:\connPath.txt" , FileMode.Open, FileAccess.Read);
StreamReader m_streamReader = new StreamReader(fs);
path = m_streamReader.ReadLine();
SqlConnection sqlConn = new SqlConnection(path);
******* If I use the following it works just fine:
path = "data source = Saloo\\VSdotNET;database=Test_DB;trusted_connection=yes";
SqlConnection sqlConn = new SqlConnection(path);
*******
I have no clue at this moment as to how to fix this problem. I would really appreciate some help.
Thanks