V
Vicky via DotNetMonster.com
Hi,
Could anyone help me with some info how to create app.config file.
I need to put code of directory info in there, Thank you very much!
DirectoryInfo di = new DirectoryInfo("C:\\Vicky Development\\FundExplorer\\
Index\\Copy of IntlIndex");
---------------------------------------------------------------------
I know in app.config may like below
---------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- User application and configured property settings go here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="reportingService.ServerName" value="Http://Localhost" />
<!-- No ending "/" -->
<add key="connOperations.ConnectionString" value="Integrated
Security=SSPI;Persist Security Info=False;Data Source=HIRST-IT1\
TEST;Initial Catalog=FundManager42205;" />
</appSettings>
</configuration>
------------------------------------------------------------------------
And in the code when I create Reader I do below
System.Configuration.AppSettingsReader appReader =
new System.Configuration.AppSettingsReader()
;
string connString = (string)appReader.GetValue(
"connOperations.ConnectionString",typeof
(string));
SqlConnection conn = new SqlConnection(connString);
------------------------------------------------------------------------
Here is begining part of the code
------------------------------------------------------------------
namespace dataReader
{
class Class1
{
[STAThread]
public static void Main(string[] args)
{
DirectoryInfo di = new DirectoryInfo("C:\\Vicky Development\\FundExplorer\\
Index\\Copy of IntlIndex");
// Get a reference to each file in that directory.
FileInfo[] fiArr = di.GetFiles();
int FundID=0;
int PeriodicityID = 0;;
string Ticker=null;
string currentLine = null;
//set up sql connection string
string myConnString= "workstation id=HIRST-IT1;packet size=4096;"+
"Integrated Security=SSPI;initial catalog=FundManager42205;"+ "Data
Source=HIRST-IT1\\TEST;"+
"persist security info=True";
// for each file in Directory, if TickerName match DB, load data
foreach (FileInfo fri in fiArr)
{
StreamReader sr = new StreamReader("C:\\Vicky Development\\FundExplorer\\
Index\\Copy of IntlIndex\\"+fri.Name);
//read the text file
//read the first row --header
currentLine = sr.ReadLine();
//read the second row contains data
currentLine = sr.ReadLine();
-
-
-
-
-
}
Could anyone help me with some info how to create app.config file.
I need to put code of directory info in there, Thank you very much!
DirectoryInfo di = new DirectoryInfo("C:\\Vicky Development\\FundExplorer\\
Index\\Copy of IntlIndex");
---------------------------------------------------------------------
I know in app.config may like below
---------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- User application and configured property settings go here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="reportingService.ServerName" value="Http://Localhost" />
<!-- No ending "/" -->
<add key="connOperations.ConnectionString" value="Integrated
Security=SSPI;Persist Security Info=False;Data Source=HIRST-IT1\
TEST;Initial Catalog=FundManager42205;" />
</appSettings>
</configuration>
------------------------------------------------------------------------
And in the code when I create Reader I do below
System.Configuration.AppSettingsReader appReader =
new System.Configuration.AppSettingsReader()
;
string connString = (string)appReader.GetValue(
"connOperations.ConnectionString",typeof
(string));
SqlConnection conn = new SqlConnection(connString);
------------------------------------------------------------------------
Here is begining part of the code
------------------------------------------------------------------
namespace dataReader
{
class Class1
{
[STAThread]
public static void Main(string[] args)
{
DirectoryInfo di = new DirectoryInfo("C:\\Vicky Development\\FundExplorer\\
Index\\Copy of IntlIndex");
// Get a reference to each file in that directory.
FileInfo[] fiArr = di.GetFiles();
int FundID=0;
int PeriodicityID = 0;;
string Ticker=null;
string currentLine = null;
//set up sql connection string
string myConnString= "workstation id=HIRST-IT1;packet size=4096;"+
"Integrated Security=SSPI;initial catalog=FundManager42205;"+ "Data
Source=HIRST-IT1\\TEST;"+
"persist security info=True";
// for each file in Directory, if TickerName match DB, load data
foreach (FileInfo fri in fiArr)
{
StreamReader sr = new StreamReader("C:\\Vicky Development\\FundExplorer\\
Index\\Copy of IntlIndex\\"+fri.Name);
//read the text file
//read the first row --header
currentLine = sr.ReadLine();
//read the second row contains data
currentLine = sr.ReadLine();
-
-
-
-
-
}