TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sercanparlak
NA
1
0
Dataset BindingContext problem
May 2 2006 7:07 AM
hi, i have problem with dataset. I create a form that has two textboxes, 1 datagrid and 4 buttons. textboxes are binding to dateset's columns. my problem is when i want to add a new record to dataset with "BindingContext[dataSet11, "deneme"].AddNew()" it adds a new row at the end of dataset with null values. And updates current row with values that i want to add to the last row of dataset. thanks for helps. Here Is My Code ---------------- //Fill's dataset private void button1_Click(object sender, System.EventArgs e) { dataSet11.Clear(); sqlDataAdapter1.Fill(dataSet11); dataGrid1.DataSource=dataSet11.Tables["deneme"]; } private void dataGrid1_Click(object sender, System.EventArgs e) { this.BindingContext[dataSet11,"deneme"].Position=dataGrid1.CurrentRowIndex; } //delete current row private void button4_Click(object sender, System.EventArgs e) { this.BindingContext[dataSet11, "deneme"].RemoveAt(this.BindingContext[dataSet11, "deneme"].Position); } //add new record to dataset private void button2_Click(object sender, System.EventArgs e) { BindingContext[dataSet11, "deneme"].AddNew(); BindingContext[dataSet11, "deneme"].EndCurrentEdit(); } //update current row private void button3_Click(object sender, System.EventArgs e) { //this.textBox1.DataBindings["Text"].BindingManagerBase.EndCurrentEdit(); BindingContext[dataSet11, "deneme"].EndCurrentEdit(); } //update database private void button5_Click(object sender, System.EventArgs e) { sqlDataAdapter1.Update(dataSet11); }
Reply
Answers (
0
)
Removing components from FORM DESIGNER
How to run other apps