Update metod doesnt work !!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dany13
    New Member
    • Apr 2008
    • 5

    Update metod doesnt work !!

    hi all.
    i using some text box for input value and some localvarible for passing this data to dataset . give instance for correct row of dataset and data in data table . use one gird view for showing curent data in dataset . in end i am calling update metod to insert data in sql database but this metod doesnt work correctly.
    at all doesnt work. but givenot any error .
    fill data from my database (work propebly)
    Code:
       this.registerTableAdapter.Fill(this.register._Register);
    Code:
    string Fname = txtFname.Text;
                    string Lname = txtLname.Text;
                    string Email = txtEmail.Text;
                    string SerialNumber = txtSerilNumber.Text;
                    City = comboBoxCity.SelectedItem.ToString(); 
                    Boolean Male = radioButtonMale.Checked;
                    if (SerialNumber != string.Empty )
                    {
                        UpDate(Fname, Lname, Email,  City, SerialNumber, Male);
                    }
     private void UpDate(string Fname, string Lname, string Email, string City, string SerialNumber, bool Male)
            {
                Register.RegisterRow NewRow = register._Register.NewRegisterRow();
                NewRow.Fname= Fname;
                NewRow.Lname = Lname;
                NewRow.City= City;
                NewRow.SerialNumber= SerialNumber;
                NewRow.Male= Male;
                NewRow.Acitivation = true;
                NewRow.sendMail = true;
                NewRow.Email = Email;
                NewRow.SerialNumber = SerialNumber;
                try
                {       
                    register._Register.AddRegisterRow(NewRow);
                }
                catch(Exception ex)
                { }
    i try to add my data exacly to database via this cod :
    Code:
     //registerTableAdapter.Insert(1, SerialNumber, "", "", true, "", true, "", true, "", "", DateTime.Now);
    but dont work.
    please help me.
    thank you ,saeid.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    What do you mean by "doesn't work"?
    Was there an error message?
    What are the columns of your table?
    Are you sure your columns are in the right order?
    Does it compile?
    Are there any warnings?


    Generally you add new rows to your DataTable(DataS et), not the DataAdapter?

    Comment

    Working...