jeudi 5 juillet 2018

How I can save *.docx faile in sql server and show it

I have some problem. I'am try to save *.docx fail in sql server and show it in web-site. I can save my faile in sql server using this code

 Byte[] bytes = File.ReadAllBytes(varFilePath);
        String file = Convert.ToBase64String(bytes);
        using (SqlConnection sql_connetion = new SqlConnection(ConfigurationManager.ConnectionStrings["Database_connection"].ConnectionString))
        {
            sql_connetion.Open();
            using (var sqlWrite = new SqlCommand("INSERT INTO use_of_rule (ID, taj) Values('3', @File)", sql_connetion))
            {
                sqlWrite.Parameters.Add("@File", bytes);
                sqlWrite.ExecuteNonQuery();
                return "ok";
            }
        }

But I can't show it in web-site. How I can?




Aucun commentaire:

Enregistrer un commentaire