954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

error while i am writing the code to file upload

hai friends,
i am writing the code for file upload .the document file is stored on the sqlserver databse.
i taken the one file upload control and button.
in the sqlserver i create a table and a procedure and witten the code.
but it gives error at show files method
please tellme the solution for that..
the code is as follows:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        tdUploadStatus.InnerText = ShowFiles(1);
    }



    private string ShowFiles(int WeekID)
{
         SqlParameter param = null;
         SqlConnection conn = new SqlConnection();
         conn.ConnectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=CSMS;Integrated Security=true";
  
         SqlCommand cmd = new SqlCommand("showUploadedFiles", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         param = new SqlParameter("@WeekID", SqlDbType.Int, 4);
         param.Value = WeekID;
         cmd.Parameters.Add(param);
     }

    }


please send me ASAp.because it is urgent for me;;
thanks & regards,

chiruthakumar

chirutha12345
Newbie Poster
3 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
 

What's the error it's givving you?
Did you try the stored procedure in your sqlserver?

regards

4advanced
Junior Poster in Training
67 posts since Nov 2008
Reputation Points: 33
Solved Threads: 10
 

it gives error like this:

Error 1 '_Default.ShowFiles(int)': not all code paths return a value c:\inetpub\wwwroot\WebSite11\Default.aspx.cs 25 20 http://localhost/WebSite11/

chirutha12345
Newbie Poster
3 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
 

Did you try your stored procedure? Does it return the correct values?

Also the parameter method is deprecated....you should use AddWithValue("yourParameterName", yourParameterValue)

4advanced
Junior Poster in Training
67 posts since Nov 2008
Reputation Points: 33
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You