Member 12962919 Ответов: 1

Не существует сопоставления типа объекта system.web.ui.webcontrols.textbox с известным собственным типом управляемого поставщика.


Я получаю эту ошибку.

Соответствия не существует от системы типа объекта.Веб.Пользовательского интерфейса.WebControls.Текстовое поле для известного собственного типа управляемого поставщика.

Что я уже пробовал:

string referalsource = "";
            for (int i = 0; i < chreferalsource.Items.Count; i++)
            {
                if (chreferalsource.Items[i].Selected)
                {
                    referalsource = referalsource + chreferalsource.Items[i].Text + ", ";
                }
            }
            for (int i = 0; i < chkreferalsource1.Items.Count - 1; i++)
            {
                if (chkreferalsource1.Items[i].Selected)
                {
                    referalsource = referalsource + chkreferalsource1.Items[i].Text + ", ";
                }
            }
            referalsource = referalsource + txtothers.Text.Trim();
            String employementdesire = "";
            for (int i = 0; i < chkemployementdesired.Items.Count; i++)
            {
                if (chkemployementdesired.Items[i].Selected)
                {
                    employementdesire = employementdesire + chkemployementdesired.Items[i].Text + ", ";
                }
            }
            string shift = "";
            for (int i = 0; i < chkshift.Items.Count; i++)
            {
                if (chkshift.Items[i].Selected)
                {
                    shift = shift + chkshift.Items[i].Text + ", ";
                }
            }
            string licensetype = "";
            for (int i = 0; i < chklicensetype.Items.Count; i++)
            {
                if (chklicensetype.Items[i].Selected)
                {
                    shift = shift + chklicensetype.Items[i].Text + ", ";
                }
            }
            string computerskills = "";
            for (int i = 0; i < chkcomskills.Items.Count; i++)
            {
                if (chkcomskills.Items[i].Selected)
                {
                    computerskills = computerskills + chkcomskills.Items[i].Text + ", ";
                }
            }
            for (int i = 0; i < chkcomskills1.Items.Count; i++)
            {
                if (chkcomskills1.Items[i].Selected)
                {
                    computerskills = computerskills + chkcomskills1.Items[i].Text + ", ";
                }
            }
            computerskills = computerskills +","+ txtotherlist.Text.Trim();
            string fullname = txtlname.Text.Trim() + " " + txtfname.Text.Trim() + " " + txtmname.Text.Trim();
            string provideaworkpermit = "";
            if (rbunderyes.Checked)
            {
                provideaworkpermit = "Yes";
            }
            else if (rbunderno.Checked)
            { provideaworkpermit = "No"; }
            string filledapplicationbefore = "";
            if (rbworkedhere.Checked)
            {
                filledapplicationbefore = "Yes";
            }
            else if (rbworkedhereno.Checked)
            {
                filledapplicationbefore = "No";
            }
            string employedhere = "";
            if (rbemployedhere.Checked)
            {
                employedhere = "Yes";
            }
            else if (rbemployedhereno.Checked)
            {
                employedhere = "No";
            }
            string currentlyemployed = "";
            if (rbcurrentlyemployed.Checked)
            {
                currentlyemployed = "Yes";
            }
            else if (rbcurrentlyemployedno.Checked)
            {
                currentlyemployed = "No";
            }
            string contactemployer = "";
            if (rbcancontact.Checked)
            {
                contactemployer = "Yes";
            }
            else if (rbcancantact.Checked)
            {
                contactemployer = "No";
            }
            string eligibleinus = "";
            if (rbhired.Checked)
            {
                eligibleinus = "Yes";
            }
            else if (rbhiredno.Checked)
            {
                eligibleinus = "No";
            }
            string cantravel = "";
            if (rbtravel.Checked)
            {
                cantravel = "Yes";
            }
            else if (rbtravelno.Checked)
            {
                cantravel = "No";
            }
            string driverlicense = "";
            if (rblicense.Checked)
            {
                driverlicense = "Yes";
            }
            else if (rblicenseno.Checked)
            {
                driverlicense = "No";
            }
            using (SqlConnection con = new SqlConnection(conn))
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("sp_insertemployerdata", con);
                    con.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FullName", fullname);
                    cmd.Parameters.AddWithValue("@Date", txtdate.Text.Trim());
                    cmd.Parameters.AddWithValue("@PositionApplidfor", txtposition1.Text.Trim());
                    cmd.Parameters.AddWithValue("@PositionAppliedFor", txtposition2.Text.Trim());
                    cmd.Parameters.AddWithValue("@ReferalSource", referalsource);
                    cmd.Parameters.AddWithValue("@Address", txtaddress.Text.Trim());
                    cmd.Parameters.AddWithValue("@HomeTelephone", txttelephone.Text.Trim());
                    cmd.Parameters.AddWithValue("@CellPhone", txtcellphone.Text.Trim());
                    cmd.Parameters.AddWithValue("@Email", txtemail.Text.Trim());
                    cmd.Parameters.AddWithValue("@SocialSecurityNO", txtsocialsecrutyno.Text.Trim());
                    cmd.Parameters.AddWithValue("@Provideaworkpermit", provideaworkpermit);
                    cmd.Parameters.AddWithValue("@Filledapplicationbeforedate", txtworkedhere.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployedBeforedate", txtemployedhere.Text.Trim());
                    cmd.Parameters.AddWithValue("@contactemployer", contactemployer);
                    cmd.Parameters.AddWithValue("@Filledapplicationbefore", filledapplicationbefore);
                    cmd.Parameters.AddWithValue("@EmployedBefore", employedhere);
                    cmd.Parameters.AddWithValue("@CurrentlyEmloyed", currentlyemployed);
                    cmd.Parameters.AddWithValue("@EligibleinUS", eligibleinus);
                    cmd.Parameters.AddWithValue("@Employementdesired", employementdesire);
                    cmd.Parameters.AddWithValue("@WhenTOstart", txtstart.Text.Trim());
                    cmd.Parameters.AddWithValue("@Shift", shift);
                    cmd.Parameters.AddWithValue("@Cantravell", cantravel);
                    cmd.Parameters.AddWithValue("@Driverlicense", driverlicense);
                    cmd.Parameters.AddWithValue("@DriverLicenseNO", txtlicenseno.Text.Trim());
                    cmd.Parameters.AddWithValue("@StateOfIssue", txtstateofissue.Text.Trim());
                    cmd.Parameters.AddWithValue("@LicenseExpiryDate", txtexpiredate.Text.Trim());
                    cmd.Parameters.AddWithValue("@LicenseType", licensetype);
                    cmd.Parameters.AddWithValue("@Highschoolname", txthighscoolname.Text.Trim());
                    cmd.Parameters.AddWithValue("@HighschoolAddress", txthighschoollocation.Text.Trim());
                    cmd.Parameters.AddWithValue("@Highschoolyears", txthighschoolyears.Text.Trim());
                    cmd.Parameters.AddWithValue("@Highschooldegree", txthighschooldegree.Text.Trim());
                    cmd.Parameters.AddWithValue("@Collegename", txtcollegename.Text.Trim());
                    cmd.Parameters.AddWithValue("@CollegeAddress", txtcollegelocation.Text.Trim());
                    cmd.Parameters.AddWithValue("@Collegeyears", txtcollegeyears.Text.Trim());
                    cmd.Parameters.AddWithValue("@Collegedegree", txtcollegedegree.Text.Trim());
                    cmd.Parameters.AddWithValue("@Graduateschoolname", txtgraduatename.Text.Trim());
                    cmd.Parameters.AddWithValue("@GraduateschoolAddress", txtgradutelocation.Text.Trim());
                    cmd.Parameters.AddWithValue("@Graduateschoolyears", txtgraduateyears.Text.Trim());
                    cmd.Parameters.AddWithValue("@Graduateschooldegree", txtgraduatedegree.Text.Trim());
                    cmd.Parameters.AddWithValue("@TradeSchoolname", txttradename.Text.Trim());
                    cmd.Parameters.AddWithValue("@TradeSchoolAddress", txttradelocation.Text.Trim());
                    cmd.Parameters.AddWithValue("@TradeSchoolyears", txttradeyears.Text.Trim());
                    cmd.Parameters.AddWithValue("@TradeSchooldegree", txttradedegree.Text.Trim());
                    cmd.Parameters.AddWithValue("@ProSchoolname", txtprofessionalname.Text.Trim());
                    cmd.Parameters.AddWithValue("@ProSchoolAddress", txtprofessionallocation.Text.Trim());
                    cmd.Parameters.AddWithValue("@ProSchoolyears", txtprofessionalyears.Text.Trim());
                    cmd.Parameters.AddWithValue("@ProSchooldegree", txtprofessionaldegree.Text.Trim());
                    cmd.Parameters.AddWithValue("@Honorsname", txthonorsname.Text.Trim());
                    cmd.Parameters.AddWithValue("@HonorsAddress", txthonorslocation.Text.Trim());
                    cmd.Parameters.AddWithValue("@Honorsyears", txthonorsyears.Text.Trim());
                    cmd.Parameters.AddWithValue("@Honorsdegree", txthonorsdegree.Text.Trim());
                    cmd.Parameters.AddWithValue("@ComputerSkills", computerskills);
                    cmd.Parameters.AddWithValue("@OtherSpecialskilss", txtotherskills.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerName", txtemployer.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerfrom", txtfrom.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerto", txtto.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerpayrate", txtpayrate.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerAddress", txtemployeraddress.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employersupervisor", txtsupervisor.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerJobtitle", txtjobtitle.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerreasonforleaving", txtreasonleaving.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerworkperformed", txtworkperformed.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerName1", txtemployer1.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerfrom1", txtfrom1.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerto1", txtto1.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerpayrate1", txtpayrate1.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerAddress1", txtemployeraddress1.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employersupervisor1", txtsupervisor1.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerJobtitle1", txtjobtitle1.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerreasonforleaving1", txtreasonleaving1.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerworkperformed1", txtworkperformed1.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerName2", txtemployer2.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerfrom2", txtfrom2.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerto2", txtto2.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerpayrate2", txtpayrate2.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerAddress2", txtemployeraddress2.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employersupervisor2", txtsupervisor2.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerJobtitle2", txtjobtitle2.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerreasonforleaving2", txtreasonleaving2.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerworkperformed2", txtworkperformed2.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerName3", txtemployer3.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerfrom3", txtfrom3.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerto3", txtto3.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerpayrate3", txtpayrate3.Text.Trim());
                    cmd.Parameters.AddWithValue("@EmployerAddress3", txtemployeraddress3.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employersupervisor3", txtsupervisor3);
                    cmd.Parameters.AddWithValue("@EmployerJobtitle3", txtjobtitle3.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerreasonforleaving3", txtreasonleaving3.Text.Trim());
                    cmd.Parameters.AddWithValue("@Employerworkperformed3", txtworkperformed3.Text.Trim());
                    cmd.Parameters.AddWithValue("@Referencename", txtreferenecename.Text.Trim());
                    cmd.Parameters.AddWithValue("@ReferncePosition", txtreferenceposition.Text.Trim());
                    cmd.Parameters.AddWithValue("@Refrencecompany", txtrefrencecompany.Text.Trim());
                    cmd.Parameters.AddWithValue("@ReferenceAddress", txtreferenceaddrss.Text.Trim());
                    cmd.Parameters.AddWithValue("@Referencetelephone", txtrefencetelephone.Text.Trim());
                    cmd.Parameters.AddWithValue("@Referencename1", txtreferencename1.Text.Trim());
                    cmd.Parameters.AddWithValue("@ReferncePosition1", txtreferenceposition1.Text.Trim());
                    cmd.Parameters.AddWithValue("@Refrencecompany1", txtreferencecompany1.Text.Trim());
                    cmd.Parameters.AddWithValue("@ReferenceAddress1", txtrefernceaddress.Text.Trim());
                    cmd.Parameters.AddWithValue("@Referencetelephone1", txtreferncetelephone1.Text.Trim());

                    int i = cmd.ExecuteNonQuery();

1 Ответов

Рейтинг:
1

OriginalGriff

Эта линия:

cmd.Parameters.AddWithValue("@Employersupervisor3", txtsupervisor3);
Нуждается в свойстве Text:
cmd.Parameters.AddWithValue("@Employersupervisor3", txtsupervisor3.Text);