By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,882 Members | 2,453 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,882 IT Pros & Developers. It's quick & easy.

System.ArgumentException: Empty path name is not legal.

P: 1
hi,

i am getting an exception while populating the data in the datagrid.

am getting the values into datatable and binding it to the datagrid but it is not
displaying the data and giving an exception like

System.ArgumentException: Empty path name is not legal.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at Common.Logger.Write_line_to_Log(String message, String logFile)
Jul 18 '07 #1
Share this Question
Share on Google+
2 Replies


Plater
Expert 5K+
P: 7,872
That error message relates to File IO. That doesn't seem like something that would happen from a databind.
Check the line location for the error and post the code associated with it?
Jul 18 '07 #2

TRScheel
Expert 100+
P: 638
hi,

i am getting an exception while populating the data in the datagrid.

am getting the values into datatable and binding it to the datagrid but it is not
displaying the data and giving an exception like

System.ArgumentException: Empty path name is not legal.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at Common.Logger.Write_line_to_Log(String message, String logFile)

I am going out a limb here, but you have a StreamWriter somewhere. On the initialization of that StreamWriter, you passed an empty string as the file location.

Something like:

Expand|Select|Wrap|Line Numbers
  1. string FileLocation;
  2. StreamWriter SWriter = new StreamWriter(FileLocation);
  3.  
That will throw just that exception.
Jul 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.