By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,666 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,666 IT Pros & Developers. It's quick & easy.

Update metod doesnt work !!

P: 5
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)
Expand|Select|Wrap|Line Numbers
  1.    this.registerTableAdapter.Fill(this.register._Register);
Expand|Select|Wrap|Line Numbers
  1. string Fname = txtFname.Text;
  2.                 string Lname = txtLname.Text;
  3.                 string Email = txtEmail.Text;
  4.                 string SerialNumber = txtSerilNumber.Text;
  5.                 City = comboBoxCity.SelectedItem.ToString(); 
  6.                 Boolean Male = radioButtonMale.Checked;
  7.                 if (SerialNumber != string.Empty )
  8.                 {
  9.                     UpDate(Fname, Lname, Email,  City, SerialNumber, Male);
  10.                 }
  11.  private void UpDate(string Fname, string Lname, string Email, string City, string SerialNumber, bool Male)
  12.         {
  13.             Register.RegisterRow NewRow = register._Register.NewRegisterRow();
  14.             NewRow.Fname= Fname;
  15.             NewRow.Lname = Lname;
  16.             NewRow.City= City;
  17.             NewRow.SerialNumber= SerialNumber;
  18.             NewRow.Male= Male;
  19.             NewRow.Acitivation = true;
  20.             NewRow.sendMail = true;
  21.             NewRow.Email = Email;
  22.             NewRow.SerialNumber = SerialNumber;
  23.             try
  24.             {       
  25.                 register._Register.AddRegisterRow(NewRow);
  26.             }
  27.             catch(Exception ex)
  28.             { }
  29.  
i try to add my data exacly to database via this cod :
Expand|Select|Wrap|Line Numbers
  1.  //registerTableAdapter.Insert(1, SerialNumber, "", "", true, "", true, "", true, "", "", DateTime.Now);
but dont work.
please help me.
thank you ,saeid.
Apr 9 '08 #1
Share this Question
Share on Google+
1 Reply


Plater
Expert 5K+
P: 7,872
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(DataSet), not the DataAdapter?
Apr 9 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.