Wednesday, March 21, 2012

Save Word Doc in Db

hi

can u tell me plz how do i save a word doc or and excel sheet in sql server

thanx

This article might give you some info

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q308042

|||the other option could be to save the Word and Excel in the database as WordML and SpreadsheetML (Office's XML representations of Word and Excel documents). Would only work if you have Office XP or higher. Just another option. If you did this you could run queries on the documents content.|||

You have several options availble to you.

I believe the best option though is to save where the file is located on your local computer (or network) and then be able to load the document from that location.

|||can u send me a sample on SpreadsheetML|||

save it as a binary.

i've done this before without any issues.

|||

here's an example, it's super easy...

using (SqlConnection conn = new SqlConnection(Globals.ChatterDbConnectionString))

{

conn.Open();

using (SqlCommand cmd = conn.CreateCommand())

{

cmd.CommandText =

"update account_image_available " +

"set " +

"image = @.image, type = @.type " +

"where " +

"opgroup = @.gid";

cmd.Parameters.AddWithValue("image", data);

cmd.Parameters.AddWithValue("type", type);

cmd.Parameters.AddWithValue("gid", og.Id);

cmd.ExecuteNonQuery();

}

}

No comments:

Post a Comment