简体   繁体   中英

Save from Windows forms to SQL Server 2014

I would like to know how to save a document(txt,pdf,doc,docx,xls etc) to Microsoft SQL Server using C# windows forms. Here's the form I've designed File Upload Box . I've used the openfiledialog box but I couldn't select a file. Any help would be appreciated. Thank You!

Also what kind of datatype should be used to save file in Microsoft SQL Server? Thanks!

OpenFileDialog OpenFileDialog1 = new OpenFileDialog();
            OpenFileDialog1.Title = "Select a Document";
            if (openFileDialog1.ShowDialog() == 
System.Windows.Forms.DialogResult.OK)
            {
                this.Cursor = new Cursor(openFileDialog1.OpenFile());
            }

Kindly refer below pointers and use it as per your requirement.

Link1

Link2

Link3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM