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
Ian Kennedy
NA
5
0
Updating Access tables
Feb 4 2009 5:38 PM
Hi,
I am trying to edit/update fields in a single Access table using C# Express. I have tried the following two sets of code. Both compile and run with no reported errors. Neither actually writes any changes to the database table.
Can anyone tell me what I'm doing wrong?
Thanks
Ian
............................................................................................
Attempt #1
............................................................................................
private void EditJob(Int32 iUID) {
string sqlCmd = "UPDATE JobList SET ClientRef = '" + tbClientRef.Text + "' WHERE UID = '" + iUID.ToString() + "'";
this.jobListTableAdapter.Adapter.UpdateCommand.CommandText = sqlCmd;
iResult = this.jobListTableAdapter.Update(this.dSJobList.JobList);
this.dSJobList.AcceptChanges();
....
}
............................................................................................
Attempt #2
............................................................................................
private void EditJob(Int32 iUID) {
this.jobListTableAdapter.Fill(this.dSJobList.JobList);
DataRow[] drow = dSJobList.JobList.Select("UID = '" + iUID.ToString() + "'");
foreach (DataRow dr in drow) // Should only be one row
{
dr.BeginEdit();
dr["ClientRef"] = tbClientRef.Text;
dr.EndEdit();
dr.AcceptChanges();
this.jobListTableAdapter.Fill(this.dSJobList.JobList);
}
Reply
Answers (
1
)
C# .NET Mail Merge Problem with Word's Normal.dot template
Reg:Create any field & insert into database in vb.net