I tried to get file path using below code.
string script = File.ReadAllText(Application.StartupPath + "D:\\Tax Rouding Projects\\10-12-12 TaxRoundingUtility\\TaxRoundingUtility\\Scripts\\GP_SOP_AdjustTax.sql");
But i am getting error : The given path's format is not supported
if i try to open the file from windows explorer.. i am able to go file location..
D:\Tax Rouding Projects\10-12-12 TaxRoundingUtility\TaxRoundingUtility\Scripts\
But why i cannot using c# code...
Any thing i missed in the path...
The problem lies here
Application.StartupPath + "D:\Tax Rouding Projects\10-12-12 TaxRoundingUtility\TaxRoundingUtility\Scripts\GP_SOP_AdjustTax.sql"
This might end up giving you something like
"c:\\program files\\myappfolder\\D:\\Tax Rouding Projects\\10-12-12 TaxRoundingUtility\\TaxRoundingUtility\\Scripts\\GP_SOP_AdjustTax.sql"
which is an invalid path. Append only portion of path that you need like (the second part is just an example)
Application.StartupPath + @"\TaxRoundingUtility\Scripts\GP_SOP_AdjustTax.sql".
Also make sure to escape the '\\' in your file path strings.
Edit : As Dante has mentioned in the comment in the question, If your target path is fixed and known, you do not need the Application.StartppPath. Just load/read the file for which you have the complete path.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.