Hi Member,
Is this "Copy-Paste" code?
FileStream stream = new FileStream(aaa,FileMode.OpenOrCreate);
Response.Write(aaa);
stream.Close();
how about writing to the FileStream instead of the Response stream - you are opening the stream and close it. So no wonder the File is empty...
From your code it seems you miss some C#/programming "basics". I can just give you some general "advices".
Split your code into logical units - mixing up UI, data access and your buissness logic is not a good idea.
Your code is vulnarable to SQL injection too - and no, protecting against this is NEVER optional!
What can help to "sort your thoughts" is: Write first down what steps you have to do (e.g. as comments), fill it up with the code after that - you may can "see" then what "functions" - methods you have to implement without mixinig up things which don't belong together - and handle specific Errors to each Operation - your current code catches all exceptions - I can think of hundreds of things which could go wrong this code...
Example:
// Obtain File Path
// Insert Data
// Query for Data
// Save data into file
// Present your data
Just my 2cent...
Kind regards
Johannes