Modifying Existing Data

M

MikeY

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
 
C

Chris Capel

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
 
M

MikeY

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 said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top