Hi,
I am writing data from Employees Table(Northwind Database) to a TextFile.
Now, I want to write data from Customers Table to the SAME TextFile. In the text file, Customer Table information shoule be after Northwind information.
How do I do that?
I could write Northwind data to a file. But when I try to write Customer Table information on the same Text File, it writes only customer information deleting the Northwind information.
Please help........
sateesh kumarPosted Dec 15, 2006, 7:57 AM
plz look into this code.You will get idea.
after creating file open it in append mode and write data into it.
if u open the file in append mode it wont be overwrite.
FileStream fs = new FileStream("..\\xyz.txt", FileMode.OpenOrCreate, Access.ReadWrite);
StreamWriter s = new StreamWriter(fs);
s.Close();
fs.Close();
FileStream fs1 = new FileStream("..\\xyz.txt", FileMode.Append, FileAccess.Write);
StreamWriter s1 = new StreamWriter(fs1);
//open database (northwind) and get data
s1.Write("Title: " + title + vbCrLf); // write data into file
//close database connection
//open database (customers) and get data
s1.Write("Message: " + msg + vbCrLf);
//close database connections1.Close();
fs1.Close();
}
Regards
Sateesh
PHANI NADIGADDAPosted Dec 14, 2006, 3:35 PM