Switch to full style
You can find discussions, solutions and codes related to ASP.NET
Post a reply

Uplading Files Dynamically Using SSIS

Tue May 15, 2012 5:34 am

I have a requirement to upload excel data (from .aspx) to the SQL server. To do this I am implemented using SSIS. I have created SSIS package(deployed) and executing it using c#. When i am running the application it is working fine inserting data into the database.After this we just want to Upload file Dynamically using File Upload Control.Please Provide Coding For this Requirement



Re: Uplading Files Dynamically Using SSIS

Wed May 16, 2012 12:30 am

What i understood that you need to upload file (excel file ) using ASP.NET, following ASP.NET using visual basic. Following ASP.NET 2 :
Code:
<%@ Page Language="VB" %>

<
script runat="server">
    Protected 
Sub FunUploadFile(ByVal sender As Object_
      ByVal e 
As System.EventArgs)
        If 
UploadParam.HasFile Then
            
Try
                
UploadParam.SaveAs("C:\Temp\" & _
                   UploadParam.FileName)
                msgLabel.Text = "
Name" & _
                   UploadParam.PostedFile.FileName & "
<br>" & _
                   " 
Size" & _
                   UploadParam.PostedFile.ContentLength & " 
kb<br>" & _
                   "
Content type" & _
                   UploadParam.PostedFile.ContentType
            Catch ex As Exception
                msgLabel.Text = "
err" & ex.Message.ToString()
            End Try
        Else
            msgLabel.Text = " 
No file specified...."
        End If
    End Sub
</script>

<html >
<head runat="
server">
    <title>Upload Files</title>
</head>
<body>
    <form id="
myForm" runat="server">
    <div>
        <asp:FileUpload ID="
UploadParam" runat="server" /><br />
        <br />
        <asp:Button ID="
Button1" runat="server" OnClick="FunUploadFile
         Text="
Upload File" />&nbsp;<br />
        <br />
        <asp:Label ID="
msgLabel" runat="server"></asp:Label></div>
    </form>
</body>
</html>

and this generate html code as :
Code:
<html >
<
head><title>
   
Upload Files
</title></head>
<
body>
    <
form name="myForm" method="post" action="fileUpload.aspx" 
     
id="myForm" enctype="multipart/form-data">
<
div>
<
input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="Genereted Value" />
</
div>

    <
div>
        <
input type="file" name="UploadParam" id="UploadParam" /><br />
        <
br />
        <
input type="submit" name="Button1" value="Upload File" 
         
id="Button1" />&nbsp;<br />
        <
br />
        <
span id="Label1"></span>
    </
div>
    
<
div>

   <
input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" 
    
value="Genereted Value" />
</
div></form>
</
body>
</
html>
 

When this code run, the user select a file to upload, as you notice that the destination folder is determined at the ASP code. Please note that the destination folder writing permissions should be set correctly. You may notice that “FileUpload” control element in VB was converted to <input type…> HTML element.

Post a reply
  Related Posts  to : Uplading Files Dynamically Using SSIS
 connect SSIS package with ASP.net     -  
 SSIS .dtsx packages and .net     -  
 Dynamically Create Image     -  
 Calling Functions Dynamically     -  
 Add new row dynamically to table using JQuery     -  
 invoke class method dynamically in php     -  
 Add and Remove CSS classes to html tag dynamically     -  
 Dynamically Setting and Accessing Variables     -  
 change link <a> attributes dynamically     -  
 How To Store Date Dynamically as a field in mysql using JSP     -  

Topic Tags

ASP Files and I/O