开发者

System.IO.FileMode.Open

开发者 https://www.devze.com 2023-01-28 16:48 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号