Hi everybody,
How can I upload and image and save it into SQL Server database using ADO.net and WCF service or webservice ?
I am working on a silverlight application . language is C#
Upload and save image into dabase
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Gohil JayendrasinhRank #490 · 5K reputationPosted Mar 29, 2012, 4:05 AM EDT
Uisng LINQ to SQL
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile && FileUpload1.PostedFile.ContentLength > 0)
{
string fileName = FileUpload1.FileName;
byte[] fileByte = FileUpload1.FileBytes;
Binary binaryObj = new Binary(fileByte);
DataClasses1DataContext context = new DataClasses1DataContext();
context.ImageTables.InsertOnSubmit(
new ImageTable { Id = "xyz",
Name = fileName,
FileSource = binaryObj });
context.SubmitChanges();
}
}
Wael Moula7 reputationPosted Mar 29, 2012, 4:17 AM EDT
But have you a tutorial that shows everything ( the wcf service , the classes ... ) step by step
Krishna GaradRank #191 · 12.8K reputationPosted Mar 29, 2012, 4:55 AM EDT
on right side of this post.
Wael Moula7 reputationPosted Mar 29, 2012, 7:15 AM EDT