I am trying to update a mysql table through C# mysql client but my Mysql server is throwing following error:
MySql.Error: column Emp_Name Can't be null
I dont know where I am commiting a mistake...below is my query source code:
commandLine = @"update employee_details set Emp_Name = @Emp_Name ,Emp_Mname = @Emp_Mname , Emp_Lname= @Emp_Lname , Emp_DOB= @Emp_DOB , Emp_Permanent_Addr = @Emp_Permanent_Addr, Emp_Present_Addr = @Emp_Present_Addr, Emp_ContactNo= @Emp_ContactNo,
Emp_emailId = @Emp_emailId,Emp_Sex = @Emp_Sex,Emp_Mar_Stat = @Emp_Mar_Stat,Emp_Nationality = @Emp_Nationality,Emp_Highest_Education = @Emp_Highest_Education,Emp_FOS = @Emp_FOS,Emp_Last_Course_SD = @Emp_Last_Course_SD,Emp_Last_Course_ED = @Emp_Last_Course_ED,Emp_Last_Inst_Name=@Emp_last_Inst_Name,
Emp_Last_Inst_Loc=@Emp_Last_Inst_Loc,Emp_Educational_Sumary=@Emp_Educational_Sumary,Emp_Pan_No=@Emp_Pan_No,Emp_TIN_No=@Emp_TIN_No,Emp_Passport_No=@Emp_Passport_No,Emp_PHIL_No=@Emp_PHIL_No,Emp_PAG=@Emp_PAG,Emp_Last_Job_Title=@Emp_Last_Job_Title,
Emp_Last_Com_Name=@Emp_Last_Com_Name,Emp_Last_Industry_Type=@Emp_Last_Industry_Type,Emp_Last_Job_Start_Date=@Emp_Last_Job_Start_Date,Emp_Last_Job_End_Date=@Emp_Last_Job_End_Date,Emp_Last_Job_Role=@Emp_Last_Job_Role,Emp_Last_Industry_Location=@Emp_Last_Industry_Location;";
cmd.CommandText = commandLine;
MessageBox.Show(tbFname.Text);
cmd.Parameters.AddWithValue("@Emp_Name", tbFname.Text);
cmd.Parameters.AddWithValue("@Emp_Mname", tbMName.Text);
cmd.Parameters.AddWithValue("@Emp_Lname", tbLName.Text);
cmd.Parameters.AddWithValue("@Emp_DOB", dateTimePickerDOB.Value.ToString("yyyy-MM-dd"));
cmd.Parameters.AddWithValue("@Emp_Permanent_Addr", tbPermanentAddr.Text + tbPermanentPin.Text);
cmd.Parameters.AddWithValue("@Emp_Present_Addr", tbPresentAddr.Text + tbPresentPin.Text);
cmd.Parameters.AddWithValue("@Emp_ContactNo", tbContactNo.Text);
cmd.Parameters.AddWithValue("@Emp_emailId", tbEmail.Text);
cmd.Parameters.AddWithValue("@Emp_Sex", cbGender.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@Emp_Mar_Stat", cbCivilStatus.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@Emp_Nationality", tbNationality.Text);
cmd.Parameters.AddWithValue("@Emp_Highest_Education", cbEducationLevel.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@Emp_FOS", tbFOS.Text);
cmd.Parameters.AddWithValue("@Emp_Last_Course_SD", dateTimePickerEducationSD.Value.ToString("yyyy-MM-dd"));
cmd.Parameters.AddWithValue("@Emp_Last_Course_ED", dateTimePickerEducationED.Value.ToString("yyyy-MM-dd"));
cmd.Parameters.AddWithValue("@Emp_last_Inst_Name", tbInstitutionname.Text);
cmd.Parameters.AddWithValue("@Emp_Last_Inst_Loc", tbInstLoc.Text);
cmd.Parameters.AddWithValue("@Emp_Educational_Sumary", tbInstSummary.Text);
cmd.Parameters.AddWithValue("@Emp_Pan_No", tbPAN.Text);
cmd.Parameters.AddWithValue("@Emp_TIN_No", tbTIN.Text);
cmd.Parameters.AddWithValue("@Emp_Passport_No", tbPassport.Text);
cmd.Parameters.AddWithValue("@Emp_PHIL_No", tbPhil.Text);
cmd.Parameters.AddWithValue("@Emp_PAG", tbPag.Text);
cmd.Parameters.AddWithValue("@Emp_Last_Job_Title", tbJobTitle.Text);
cmd.Parameters.AddWithValue("@Emp_Last_Com_Name", tbCompName.Text);
cmd.Parameters.AddWithValue("@Emp_Last_Industry_Type", cbIndustryType.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@Emp_last_Job_Start_Date", dateTimePickerJobSD.Value.ToString("yyyy-MM-dd"));
cmd.Parameters.AddWithValue("@Emp_last_Job_End_Date", dateTimePickerJobED.Value.ToString("yyyy-MM-dd"));
cmd.Parameters.AddWithValue("@Emp_Last_Job_Role", tbJobRole.Text);
cmd.Parameters.AddWithValue("@Emp_Last_Industry_Location", tbIndustryLoc.Text);
--------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
Can any one plz tell me where am I wrong in this.....And yes Emp_Name is a not null column...but the value I am passing from tbFname is not a null but a proper string....
Thanks in advance...