c# - "@p4 : String truncation: max=4, len=6, value='Female'." error when inserting to database -


i having students database typed dataset. have 10 columns. problem gender column. whenever manually typing in datagrid , saving saving fine. when im importing data excel file , saving database error

@p4 : string truncation: max=4, len=6, value='female'

i have set maxlength 6 in dataset.xsd , nchar(6) in database schema. below code..

for (int = 0; < dt.rows.count; i++) {     datarow row = this.dataset.studentsdatabase.newrow();     this.dataset.studentsdatabase.rows.add(row);     this.sbdgv.rows[i].defaultcellstyle.backcolor = color.yellow;      this.dataset.studentsdatabase.rows[i]["class"] = dt.rows[i]["class"];     this.dataset.studentsdatabase.rows[i]["section"] = dt.rows[i]["section"];     this.dataset.studentsdatabase.rows[i]["name"] = dt.rows[i]["name"];     this.dataset.studentsdatabase.rows[i]["gender"] = dt.rows[i]["gender"];     this.dataset.studentsdatabase.rows[i]["caste"] = dt.rows[i]["caste"];     this.dataset.studentsdatabase.rows[i]["present"] = dt.rows[i]["present"];     this.dataset.studentsdatabase.rows[i]["meals"] = dt.rows[i]["meals"];     this.dataset.studentsdatabase.rows[i]["dateadded"] = dt.rows[i]["dateadded"];     this.dataset.studentsdatabase.rows[i]["datedeleted"] = dt.rows[i]["datedeleted"]; } 

where dt datatable filled excel. , here save logic

private void studentsdatabasebindingnavigatorsaveitem_click(object sender, eventargs e) {          this.validate();         this.bsstudentsdatabase.endedit();//binding source         this.tastudentsdb.update(this.dataset.studentsdatabase);         messagebox.show("save successfull.", "success!", messageboxbuttons.okcancel, messageboxicon.information);     } 

can 1 tell me whats going wrong?

@p4 : string truncation: max=4, len=6, value='female'  

maximal value female 4 characters , trying insert 6 characters, have reduce length of value inserting.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -