wating for anser how to add record to database with gridjanus and bindingnavigator
-
hi every one i want add a one record to sql from grid janus and one cell from a editbox control with binding navigator but can not add and message show column code can not null. my source code:
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
codemax = Convert.ToInt32(fatemeTableAdapter.maxcode());
codemax = codemax + 1;editBox1.Text = codemax.ToString(); ((DataRowView)fatemeBindingSource1.Current).Row\["code"\] = codemax; }
and savebinding:
private void save_Click(object sender, EventArgs e)
{
int g, b;
g=Convert.ToInt32(gridEX1.CurrentRow.Cells["code_b"].Value);
b=Convert.ToInt32(gridEX1.CurrentRow.Cells["name"].Value) ;
((DataRowView)fatemeBindingSource1.Current).Row["code_b"] = g;
((DataRowView)fatemeBindingSource1.Current).Row["name"] = b;this.Validate(); fatemeBindingSource1.EndEdit(); fatemeTableAdapter.Update(this.baziDataSet1.fateme); }
i dont how get value from new row in grid please help me best a regards
-
hi every one i want add a one record to sql from grid janus and one cell from a editbox control with binding navigator but can not add and message show column code can not null. my source code:
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
codemax = Convert.ToInt32(fatemeTableAdapter.maxcode());
codemax = codemax + 1;editBox1.Text = codemax.ToString(); ((DataRowView)fatemeBindingSource1.Current).Row\["code"\] = codemax; }
and savebinding:
private void save_Click(object sender, EventArgs e)
{
int g, b;
g=Convert.ToInt32(gridEX1.CurrentRow.Cells["code_b"].Value);
b=Convert.ToInt32(gridEX1.CurrentRow.Cells["name"].Value) ;
((DataRowView)fatemeBindingSource1.Current).Row["code_b"] = g;
((DataRowView)fatemeBindingSource1.Current).Row["name"] = b;this.Validate(); fatemeBindingSource1.EndEdit(); fatemeTableAdapter.Update(this.baziDataSet1.fateme); }
i dont how get value from new row in grid please help me best a regards
i am tierd please help me.i am trying for find reply question a long time.i am tierd. i am set allowaddnew equal true.it might read from new record in grid that is bound and editbox that is unbound and add to data base and add to grid that show error column code can not be null that column code is editbox control and i was delete from column grid. or i should all coulmn from table in out gird and read from there and add to grid and database .i am mixed up :(( best a regards
-
i am tierd please help me.i am trying for find reply question a long time.i am tierd. i am set allowaddnew equal true.it might read from new record in grid that is bound and editbox that is unbound and add to data base and add to grid that show error column code can not be null that column code is editbox control and i was delete from column grid. or i should all coulmn from table in out gird and read from there and add to grid and database .i am mixed up :(( best a regards
that program in first time add a record to database and grid but in secend time show message error column code can not be null. and one problem in select a new row in grid when a type a value for a column that column is to be select and anather column not to be select and then in add record to sql one of column is 0 value. that how total record in select case. please help me :doh: :confused: :( best a regards
-
that program in first time add a record to database and grid but in secend time show message error column code can not be null. and one problem in select a new row in grid when a type a value for a column that column is to be select and anather column not to be select and then in add record to sql one of column is 0 value. that how total record in select case. please help me :doh: :confused: :( best a regards
my god i am tierd please help me. :confused:
-
my god i am tierd please help me. :confused:
i dont english as well .from all friend want to guide me for solve my problem. i am very very hope that this site firend my problem resolved... best regards
-
hi every one i want add a one record to sql from grid janus and one cell from a editbox control with binding navigator but can not add and message show column code can not null. my source code:
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
codemax = Convert.ToInt32(fatemeTableAdapter.maxcode());
codemax = codemax + 1;editBox1.Text = codemax.ToString(); ((DataRowView)fatemeBindingSource1.Current).Row\["code"\] = codemax; }
and savebinding:
private void save_Click(object sender, EventArgs e)
{
int g, b;
g=Convert.ToInt32(gridEX1.CurrentRow.Cells["code_b"].Value);
b=Convert.ToInt32(gridEX1.CurrentRow.Cells["name"].Value) ;
((DataRowView)fatemeBindingSource1.Current).Row["code_b"] = g;
((DataRowView)fatemeBindingSource1.Current).Row["name"] = b;this.Validate(); fatemeBindingSource1.EndEdit(); fatemeTableAdapter.Update(this.baziDataSet1.fateme); }
i dont how get value from new row in grid please help me best a regards
i have one table with 3 column=code,name,code_b and in form i have a bindingnavigator that addnewitem=none and bindingsource=fatemebinding and in gridex datasourc=fatemebinding and in gridex allownew=addnew and rowheader=true and headercontent =rowposition and in griddesignert click in createroottable and retrive table and then column table ceated and then code envirement newiconbinding: [php] try { fatemeBindingSource.AddNew(); codmax = Convert.ToInt32(fatemeTableAdapter.maxcode()); codmax = codmax + 1; gridEX1.CurrentRow.Cells["code"].Value = codmax; ((DataRowView)fatemeBindingSource.Current).Row["code"] = codmax; } catch { MessageBox.Show("لطفا اطلاعات را وارد کنید"); } [/php] and save iconbindingnavator: [php] private void toolStripButton1_Click(object sender, EventArgs e) { fatemeBindingSource.EndEdit(); fatemeTableAdapter.Update(this.baziDataSet1.fateme); } [/php] but in run name and code_b value to be null how to asign data column please help me