6
Answers

I Have a problem with this file uploading to particular fold

Ask a question
Maniteja Vegi

Maniteja Vegi

11y
1.2k
1

I'm using VS2010. I have Doubt

    I create a database  with name of TAX, Could you please send me a sample project? Base on the scenario. I don't know how to query and create stored procedures in MS SQL.. I just want to have an overview on which tables and fields are existing as per required by our DB Admin not to alter any table or alter any fields.

           Tables                   :    Fields

           employee              :    employee_no[Primary Key], lastname , firstname

           Document                 :     DocumentId[Primary Key], employee_no[Foreign                                                 Key],Documentname,Documentpath

        using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Data;

using System.Data.SqlClient;

using System.IO;


public partial class Form16UL : System.Web.UI.Page

{

    private SqlConnection con = new SqlConnection("Data Source=gvipl2-pc;Initial Catalog=TAX;Integrated Security=True");

    protected void Page_Load(object sender, EventArgs e)

    {

       

    }

   

    protected void btnsubmit_Click(object sender, EventArgs e)

    {

        string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);

        fileUpload1.SaveAs(Server.MapPath("Form/" + filename));

        con.Open();

        SqlCommand cmd = new SqlCommand("insert into Document(DocumentName,DocumentPath) values(@DocumentName,@DocumentPath)", con);


     

        cmd.Parameters.AddWithValue("@DocumentName", filename);

        cmd.Parameters.AddWithValue("@DocumentPath", "Form/" + filename);

        cmd.ExecuteNonQuery();

        

        con.Close();

        lblmsg.Text = "Thanx for uploading your form 16 file";

            


    }

}


Answers (6)