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

Modifying Existing Data

P: n/a
Hi everyone,

Using C#, Windows forms. I am trying to learn how to modify existing data
with in MSDE table/fields. If anyone could help me out with my code, I would
appreciate it. My code is as follows:

private void btnEmpModify_Click(object sender, System.EventArgs e)
{
DataTable thisTable = dsModifyRecord.Tables["Employee"];
//THIS IS WHERE I'M GETTING LOST
DataRow thisRow = thisTable???????????????

thisRow["EmplNumber"] = txtBoxEmplNumber.Text;
thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["DateModified"] = DateTime.Now.ToString();
thisRow["EmployeeNotes"] = txtBoxEmpNotes.Text;

//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance.

MikeY

Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
thisRow = thisTable.Rows[indexOfRowToModify];

Keep in mind that data shown in any databound control should be in the same
order as in the table, so there's a direct mapping of row indices.

Chris

"MikeY" <mi*******@yahoo.ca> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl...
Hi everyone,

Using C#, Windows forms. I am trying to learn how to modify existing data
with in MSDE table/fields. If anyone could help me out with my code, I would appreciate it. My code is as follows:

private void btnEmpModify_Click(object sender, System.EventArgs e)
{
DataTable thisTable = dsModifyRecord.Tables["Employee"];
//THIS IS WHERE I'M GETTING LOST
DataRow thisRow = thisTable???????????????

thisRow["EmplNumber"] = txtBoxEmplNumber.Text;
thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["DateModified"] = DateTime.Now.ToString();
thisRow["EmployeeNotes"] = txtBoxEmpNotes.Text;

//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance.

MikeY

Nov 15 '05 #2

P: n/a
Hi Chris,

Thank you for information.
However this is still a little fuzzey. I will look for an example. Where it
is being fuzzy is that if at run time, if I don't know what row I will be
modifying, then how do I write the syntex for that particular row ahead of
time.

Txs again
MikeY

"Chris Capel" <ch***@nowhere.com> wrote in message
news:e2**************@TK2MSFTNGP12.phx.gbl...
thisRow = thisTable.Rows[indexOfRowToModify];

Keep in mind that data shown in any databound control should be in the same order as in the table, so there's a direct mapping of row indices.

Chris

"MikeY" <mi*******@yahoo.ca> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl...
Hi everyone,

Using C#, Windows forms. I am trying to learn how to modify existing data with in MSDE table/fields. If anyone could help me out with my code, I

would
appreciate it. My code is as follows:

private void btnEmpModify_Click(object sender, System.EventArgs e)
{
DataTable thisTable = dsModifyRecord.Tables["Employee"];
//THIS IS WHERE I'M GETTING LOST
DataRow thisRow = thisTable???????????????

thisRow["EmplNumber"] = txtBoxEmplNumber.Text;
thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["DateModified"] = DateTime.Now.ToString();
thisRow["EmployeeNotes"] = txtBoxEmpNotes.Text;

//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance.

MikeY


Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.