check the image link for all steps https://drive.google.com/open?id=0B0-Ll2y6vo_sQ29hYndnbGZVZms
STEP1: I created a field of type varbinary in a table
STEP2: I created a stored procedure to accept a parameter of type sql_variant
STEP3: On my asp.net page at my end, I created an sql data source parameter of an object type
<tr> <td> UPLOAD DOCUMENT</td> <td> <asp:FileUpload ID="FileUpload1" runat="server" /> <asp:Button ID="btnUpload" runat="server" Text="Upload" /> <asp:SqlDataSource ID="sqldsFileUploadConn" runat="server" ConnectionString="<%$ ConnectionStrings: %>" InsertCommand="ph_SaveDocument" InsertCommandType="StoredProcedure"> <InsertParameters> <asp:Parameter Name="DocBinaryForm" Type="Object" /> </InsertParameters> </asp:SqlDataSource> </td> <td> </td> </tr>
STEP 4: In my code behind, I am trying to load FileBytes from FileUpload Control through this stored procedure call using the sql data source control
Dim filebytes As Object filebytes = FileUpload1.FileBytes() sqldsFileUploadConn.InsertParameters("DocBinaryForm").DefaultValue = filebytes.ToString Dim uploadstatus As Int16 = sqldsFileUploadConn.Insert() ' ... code continues ... '
James Dsouza Sep 23 '16 at 22:55 2016-09-23 22:55
source share