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.