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:
Code
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
Code
       {
            codemax = Convert.ToInt32(fatemeTableAdapter.maxcode());
           codemax = codemax + 1;

           editBox1.Text = codemax.ToString();
           ((DataRowView)fatemeBindingSource1.Current).Row["code"] = codemax;
       }
and savebinding:
Code
private void save_Click(object sender, EventArgs e)
C#
        {
            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);
        }
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
best a regards