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
Yusif Wassal
NA
12
2.8k
How to effect the database with visual controls?
Oct 12 2012 3:03 AM
Hello
I have a program for msaccess 2007 and VS 2010, every thing working correctly except saving the data to the database. by the way its reading correctly from the dbase
Here is the code:
Add new record:
private void button4_Click(object sender, EventArgs e)
{
f1.Text = "";
f2.Text = "";
newCustomersRow = pharmaDataSet.Tables["drugType"].NewRow();
newCustomersRow["DName"] = f1.Text.ToString();
newCustomersRow["Description"] = f2.Text.ToString();
pharmaDataSet.Tables["drugType"].Rows.Add(newCustomersRow);
drugTypeBindingSource.MoveLast();
DataGridViewDataErrorContexts cntxt = new DataGridViewDataErrorContexts();
dg.CommitEdit(cntxt);
drugTypeBindingSource.MoveLast();
f1.Text = "";
f2.Text = "";
}
Delete record:
private void button3_Click(object sender, EventArgs e)
{
try
{
drugTypeBindingSource.RemoveCurrent();
}
catch (Exception)
{
}
}
Save to DBase
private void button2_Click(object sender, EventArgs e)
{
this.Validate();
this.drugTypeBindingSource.EndEdit();
tableAdapterManager.UpdateAll(pharmaDataSet);
/*
* drugTypeBindingSource.DataSource = pharmaDataSet.drugType;
dg.DataSource = drugTypeBindingSource;
drugTypeTableAdapter.Update(pharmaDataSet.drugType);
*/
drugTypeTableAdapter.Update(pharmaDataSet.drugType);
pharmaDataSet.drugType.AcceptChanges();
ActiveForm.Close();
// tableAdapterManager.UpdateAll(pharmaDataSet);
}
private void ff_TextChanged(object sender, EventArgs e)
{
try
{
// customerCreditBindingSource BindingSource myBindingSource;
//dg.DataSource = drugTypeBindingSource;
//drugTypeBindingSource.DataSource = pharmaDataSet;
//drugTypeBindingSource.DataMember = pharmaDataSet.Tables[2].TableName;
drugTypeBindingSource.Filter = "DName Like '" + ff.Text + "%'";
// button2.Visible = false;
// button4.Visible = false;
}
catch (Exception) { }
}
Reply
Answers (
8
)
How to parse html based on class
combobox error