C# 将Outlook.ics文件保存到sql数据库

C# 将Outlook.ics文件保存到sql数据库,c#,sql,outlook,C#,Sql,Outlook,我正在试图找出如何允许我的用户能够使用c#/.net将outlook文件保存到sql数据库。我使用的是一个普通的文件上传控件,我想我可以只保存一个字符串,但放入一个链接按钮,但这对我来说不起作用 这是我对代码的想法: string ImageName1 = string.Empty; byte[] Image1 = null; if (Images1.PostedFile != null && Images1.PostedFile.F

我正在试图找出如何允许我的用户能够使用c#/.net将outlook文件保存到sql数据库。我使用的是一个普通的文件上传控件,我想我可以只保存一个字符串,但放入一个链接按钮,但这对我来说不起作用

这是我对代码的想法:

      string ImageName1 = string.Empty;

        byte[] Image1 = null;
        if (Images1.PostedFile != null && Images1.PostedFile.FileName != "")
        {
            ImageName1 = Path.GetFileName(Images1.FileName);
            Image1 = new byte[Images1.PostedFile.ContentLength];
            HttpPostedFile UploadedImage = Images1.PostedFile;
            Images1.PostedFile.InputStream.Read(Image1, 0, Images1.PostedFile.ContentLength);
            UploadedImage.InputStream.Read(Image1, 0, (int)Images1.PostedFile.ContentLength);
        }

任何关于如何做到这一点的信息都会很有帮助

您可以将文件作为blob存储在数据库中。 我不太懂你的代码,通常你调用一个存储过程并传递参数,或者在c#中将命令指定为文本,以便与SQL server通信

给出了如何将blob插入数据库的示例