System.IO.FileMode.Open
For my system, i first need to read CSV file and then i need to connect to the database in SQL server 2008 according to the data in .ini file.
I use System.IO.FileStream() to read file. There is no problem to open and read data.
But, when i read csv file and then connect to the database , i cant access to the .ini file because System.IO.FileStream() function take the path of ini file like as the location of csv file.
So, when i read csv file from Desktop , System.IO.FileStream() function search the ini file in Desktop and when i read from My Document, it search in My Document.
Thus, i want to know how to control this.
My function to read ini file : System.IO开发者_开发百科.FileStream("fileNameOnly", System.IO.FileMode.Open, System.IO.FileAccess.Read);
You can set your OpenFileDialog.RestoreDirectory
to True to have the dialog reset its location on each use.
精彩评论