Home > DeveloperSection > Forums > Insert data from forms into datasets
Chintoo Semi

Total Post:135

Points:947
Posted on    May-10-2013 1:54 AM

 C# C# 
Ratings:


 1 Reply(s)
 789  View(s)
Rate this:
HI Expert!

I have a dataset set up with 3 fields, ID, username and password. I want the user to type in a new username and password and this then gets saved back to the dataset. 

How do I take what has been typed in and save it into the data set?

So far this is the code I have

usersTableAdapters.UsersTableAdapter user = new usersTableAdapters.UsersTableAdapter();
user.usersDataTable usertable = user.GetData();

This allows me to connect to the data set although I am not sure how to take the values the user will enter in the input boxes and save them back to the dataset?

Thanks in advance! 



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    May-10-2013 9:06 AM

Hi Chintoo!

You can try as following. I hope it resolve your problem.

DataSet ds = new DataSet();
ds.Tables.Add(textBox1.Text);  
ds.Tables.Add(textBox2.Text);  

if (ds.HasChanges())  
   ds.AcceptChanges();

Don't want to miss updates? Please click the below button!

Follow MindStick