Error :No mapping exists from object type System.Web.UI.WebControls.FileUpload to a known managed pr

Posted by chirivellaphaniraja-14771 under ASP.NET on 4/3/2012 | Points: 10 | Views : 12668 | Status : [Member] | Replies : 2
Hi all, I am doing the insert data to my database. Besides, i also got do upload file to my database. Why when i click the submit, the error likes below keep giving.
No mapping exists from object type System.Web.UI.WebControls.FileUpload to a known managed provider native type.

My coding likes bellow

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.Configuration;


public partial class _Default : System.Web.UI.Page
{
string cs = "Data Source=SPLASH-12892AA8;Initial Catalog=raj;User ID=sa;Password=splash;";
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button2_Click(object sender, EventArgs e)
{

string EmailID = textemailid.Text;
string Password = textpassword.Text;
string FullName = textfullname.Text;
string Located = ddllocated.Text;
string MobileNumber = textmobile.Text;
string years = ddlyears.Text;
int months = Convert.ToInt32(ddlmonths.Text);
string Skills = textskills.Text;
string Profile = textprofile.Text;
string Company = ddlcompany.Text;
string Area = ddlarea.Text;
string BasicEducation = ddlbasic.Text;
string MastersEducation = ddlmasters.Text;
string DoctorateEducation = ddldoctorate.Text;
//string Fileupload1 = FileUpload;
SqlConnection con = new SqlConnection(cs);
con.Open();

SqlCommand cmd = new SqlCommand("INSERT INTO raja Values (@EmailID,@password,@FullName,@Located,@MobileNumber,@Years,@Months,@Skills,@Profile,@Company,@FunctionalArea,@BasicEducation,@MastersEducation,@DoctorateEducation,@Fileupload)", con);

cmd.Parameters.AddWithValue("@EmailID", EmailID);
cmd.Parameters.AddWithValue("@password", Password);
cmd.Parameters.AddWithValue("@FullName", FullName);
cmd.Parameters.AddWithValue("@Located", Located);
cmd.Parameters.AddWithValue("@MobileNumber", MobileNumber);
cmd.Parameters.AddWithValue("@Years", years);
cmd.Parameters.AddWithValue("@Months", months);
cmd.Parameters.AddWithValue("@Skills", Skills);
cmd.Parameters.AddWithValue("@Profile", Profile);
cmd.Parameters.AddWithValue("@Company", Company);
cmd.Parameters.AddWithValue("@FunctionalArea", Area);
cmd.Parameters.AddWithValue("@BasicEducation", BasicEducation);
cmd.Parameters.AddWithValue("@MastersEducation", MastersEducation);
cmd.Parameters.AddWithValue("@DoctorateEducation", DoctorateEducation);
cmd.Parameters.AddWithValue("@FileUpload", FileUpload);


cmd.ExecuteNonQuery();

con.Close();


try
{
FileUpload.SaveAs(@"E:\RESUMES\" + FileUpload.FileName);
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}

textemailid.Text = "";
textpassword.Text = "";
textfullname.Text = "";
textmobile.Text = "";
textskills.Text = "";
textprofile.Text = "";

textemailid.Focus();

Response.Redirect("Default2.aspx");

}
}

Thanks to u all




Responses

Posted by: Rajni.Shekhar on: 4/3/2012 [Member] Bronze | Points: 25

Up
0
Down
do you have fileupload control in your page?

Thanks,
Rajni Shekhar

chirivellaphaniraja-14771, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajni.Shekhar on: 4/3/2012 [Member] Bronze | Points: 25

Up
0
Down
do you have file upload control to browse your file?????

Thanks,
Rajni Shekhar

chirivellaphaniraja-14771, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response