Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection string format problem

Status
Not open for further replies.

prrm333

Programmer
Apr 14, 2003
97
US
I am using the following for my connection string that works successfully:

const string CONNECTION_STRING = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\calc;Extended Properties=""text;HDR=YES;"";";

I would like to replace the path in the Data Source to the return path I am able to return correctly from the xml config file. I have been unable so far to properly format the connection string to do this without errors.
 
Could you please provide the code you are using to retrieve the path from the xml confif and format the connection string. Also, please provide a snippet of the xml file that contains the path.

Scott Travis
 
The following is used to get the path:
public string getPath()
{
string _path = "";
XmlDocument document = new XmlDocument();
document.Load(@"c:\config.xml");
XmlNode node2 = document.DocumentElement.SelectSingleNode("//path");
_path = node2.InnerText.ToString();
return _path;
}

Call in the form onload to get the path returned:
string _path = getPath();

The XML file:
<config>
<configinfo>
<file>test99.txt</file>
<folder>c:\calc</folder>
<path>c:\calc\test99.txt</path>
<query>SELECT * FROM </query>
</configinfo>
</config>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top