TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ilkin East
NA
100
174.4k
c# FileStream
Jul 31 2012 3:53 PM
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.
Reply
Answers (
2
)
C# WinForm-how to open documents from SQL Server filestream
WANT A BILLING PROJECT ON DESKTOP APPLICTION IN C#