soumya p n

soumya p n

  • NA
  • 41
  • 0

Creating a text file

Jan 9 2008 12:22 AM
hiee,

Normally v create a text file using textwriter i.e,
TextWriter txt = new StreamWriter("path");
but in my case i need 2 create a text file whose name comes from database.
for example: i need 2 create a file with its name as each individual's mobile number which is stored in database.something like 1234567898.txt in which this number is retrieved frm database.
i tried doing something lik,
DataRow dr = ds.Tables[0].Rows[0];
string number = dr[5].ToString();
string path = "C:/"+number+".txt";
TextWriter txt = new StreamWriter(path);

But the error message says this path structure is not supported..

Wat can b done to solve this problem..?

Thanks in advance,
Soumya



Answers (8)