Hello
When I click word file which created FileStream it doesnt open.Unable.Please watch if I have mistake?
public void button2_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=USERPC;Initial Catalog=Service;Integrated Security=True;");
SqlCommand com = new SqlCommand("Select DocName,DocData From Data Where DocID = 1 ",conn);
conn.Open();
SqlDataReader dr = com.ExecuteReader();
while(dr.Read())
{
string fileName = "";
fileName = dr["DocName"].ToString();
byte[] docbinary = (byte[])dr["DocData"];
MessageBox.Show(Convert.ToString(docbinary.Length));
FileStream fs = new FileStream(@"C:\" + fileName, FileMode.Create);
fs.Write(docbinary, 0, docbinary.Length);
fs.Close();
fs.Dispose();
}
conn.Close();
}
Thanks.

Ilkin EastPosted Aug 1, 2012, 8:01 AM
My code is in a attached file.
Thanks
Pradip PandeyPosted Aug 1, 2012, 1:09 AM
Can you send create table script of Data table which you are using in the code.