473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help with updating & modify data

Hi everyone,

I have posted earlier this week, but I'm still scratching my head trying to
figure out how to change/modify my data back to my db.

Using C# Windows forms. I am trying to learn how to modify existing data
with in my DB/MSDE. In general, I have textbox's filled with existing data
from my "Employee" table. I have amongst other buttons, an "Update" button.
Where, when viewing, if I want to change ie the persons name, anyother
field, or all fields I want to press the update button. However I am getting
lost. My code is below with the 3 fields I want to update. Mapping is in the
correct order. Hopefully someone can help by providing correct code or a
link example.

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

thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["EmpTitle"] = txtBoxEmpTitle.Text;
//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance

MikeY
Nov 15 '05 #1
4 3561
Hi Mike,

DataTable can contain many rows, you have to select the one that you want to
update.
When you read your data froom the database, it returns several records, one
record, or no records.
How do you fill the text box with your data? Which record from your
DataTable are you using?
co**************@yahoo.com

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

I have posted earlier this week, but I'm still scratching my head trying to figure out how to change/modify my data back to my db.

Using C# Windows forms. I am trying to learn how to modify existing data
with in my DB/MSDE. In general, I have textbox's filled with existing data
from my "Employee" table. I have amongst other buttons, an "Update" button. Where, when viewing, if I want to change ie the persons name, anyother
field, or all fields I want to press the update button. However I am getting lost. My code is below with the 3 fields I want to update. Mapping is in the correct order. Hopefully someone can help by providing correct code or a
link example.

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

thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["EmpTitle"] = txtBoxEmpTitle.Text;
//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance

MikeY

Nov 15 '05 #2
Hi Mike,

DataTable can contain many rows, you have to select the one that you want to
update.
When you read your data froom the database, it returns several records, one
record, or no records.
How do you fill the text box with your data? Which record from your
DataTable are you using?
co**************@yahoo.com

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

I have posted earlier this week, but I'm still scratching my head trying to figure out how to change/modify my data back to my db.

Using C# Windows forms. I am trying to learn how to modify existing data
with in my DB/MSDE. In general, I have textbox's filled with existing data
from my "Employee" table. I have amongst other buttons, an "Update" button. Where, when viewing, if I want to change ie the persons name, anyother
field, or all fields I want to press the update button. However I am getting lost. My code is below with the 3 fields I want to update. Mapping is in the correct order. Hopefully someone can help by providing correct code or a
link example.

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

thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["EmpTitle"] = txtBoxEmpTitle.Text;
//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance

MikeY

Nov 15 '05 #3
Hi Codewriter,

I fill my textbox's with a sql datareader. What I do is a search for a
particular field. If the field is found, I output the info to textbox's but
I wanted to have the ability to mdofiy, ie persons first name if needed. A
sample of my code is as follows for the datareader/search:
try
{
string userinput = txtBoxEmpSearch.Text;
sqlConnection1.Open();
string select = "SELECT * FROM Employee WHERE (EmpID = '" + userinput +
"')";
SqlCommand cmd = new SqlCommand(select, sqlConnection1);
SqlDataReader myReader = cmd.ExecuteReader();
while(myReader.Read())
{
returnedValue = myReader.GetString(1);
userIDOutPut = Convert.ToString(myReader.GetInt32(0));
userFNameOutPut = myReader.GetString(1);
userLNameOutPut = myReader.GetString(2);
userTitleOutPut = myReader.GetString(3);
txtBoxtmp.Text = myReader.GetString(3); //Temp for Deletion
}

Thanks for help.
"codewriter" <co**************@yahoo.com> wrote in message
news:VE********************@news20.bellglobal.com. ..
Hi Mike,

DataTable can contain many rows, you have to select the one that you want to update.
When you read your data froom the database, it returns several records, one record, or no records.
How do you fill the text box with your data? Which record from your
DataTable are you using?
co**************@yahoo.com

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

I have posted earlier this week, but I'm still scratching my head trying

to
figure out how to change/modify my data back to my db.

Using C# Windows forms. I am trying to learn how to modify existing data
with in my DB/MSDE. In general, I have textbox's filled with existing data from my "Employee" table. I have amongst other buttons, an "Update"

button.
Where, when viewing, if I want to change ie the persons name, anyother
field, or all fields I want to press the update button. However I am

getting
lost. My code is below with the 3 fields I want to update. Mapping is in

the
correct order. Hopefully someone can help by providing correct code or a
link example.

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

thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["EmpTitle"] = txtBoxEmpTitle.Text;
//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance

MikeY


Nov 15 '05 #4
Hi Codewriter,

I fill my textbox's with a sql datareader. What I do is a search for a
particular field. If the field is found, I output the info to textbox's but
I wanted to have the ability to mdofiy, ie persons first name if needed. A
sample of my code is as follows for the datareader/search:
try
{
string userinput = txtBoxEmpSearch.Text;
sqlConnection1.Open();
string select = "SELECT * FROM Employee WHERE (EmpID = '" + userinput +
"')";
SqlCommand cmd = new SqlCommand(select, sqlConnection1);
SqlDataReader myReader = cmd.ExecuteReader();
while(myReader.Read())
{
returnedValue = myReader.GetString(1);
userIDOutPut = Convert.ToString(myReader.GetInt32(0));
userFNameOutPut = myReader.GetString(1);
userLNameOutPut = myReader.GetString(2);
userTitleOutPut = myReader.GetString(3);
txtBoxtmp.Text = myReader.GetString(3); //Temp for Deletion
}

Thanks for help.
"codewriter" <co**************@yahoo.com> wrote in message
news:VE********************@news20.bellglobal.com. ..
Hi Mike,

DataTable can contain many rows, you have to select the one that you want to update.
When you read your data froom the database, it returns several records, one record, or no records.
How do you fill the text box with your data? Which record from your
DataTable are you using?
co**************@yahoo.com

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

I have posted earlier this week, but I'm still scratching my head trying

to
figure out how to change/modify my data back to my db.

Using C# Windows forms. I am trying to learn how to modify existing data
with in my DB/MSDE. In general, I have textbox's filled with existing data from my "Employee" table. I have amongst other buttons, an "Update"

button.
Where, when viewing, if I want to change ie the persons name, anyother
field, or all fields I want to press the update button. However I am

getting
lost. My code is below with the 3 fields I want to update. Mapping is in

the
correct order. Hopefully someone can help by providing correct code or a
link example.

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

thisRow["EmpFName"] = txtBoxEmpFName.Text;
thisRow["EmpLName"] = txtBoxLNName.Text;
thisRow["EmpTitle"] = txtBoxEmpTitle.Text;
//& GETTING LOST HERE
dsModifyRecord.Tables["EMPLOYEE"]??????????????
sqlDataAdapter1.Update(dsModifyRecord, "Employee");
}

Thank you all in advance

MikeY


Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
0
by: MikeY | last post by:
Hi everyone, I have posted earlier this week, but I'm still scratching my head trying to figure out how to change/modify my data back to my db. Using C# Windows forms. I am trying to learn how...
0
by: 4 | last post by:
Insert/Delete/Modify Statement Shortcuts??? Help!! I am working in C# and running an Oracle 9i server. I was just wonering if there is a shortcut way of updating my tables and not have to...
1
by: Alpha | last post by:
I have a Window based application that shows up still running in the task manager when I close it. It reaches the "this.close" statement and then it stops at the "}" at the section of the...
23
by: casper christensen | last post by:
Hi I run a directory, where programs are listed based on the number of clicks they have recieved. The program with most clicks are placed on top and so on. Now I would like people to be apple to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
0
by: Shogun | last post by:
Hey guys, i'm trying to do a confirmation msgbox asking the user if he's sure about updating his database. The problem is... wathever the answer (Yes/No), the database is updated anyway! My code is...
5
by: Mike Copeland | last post by:
I'm having difficulty updating map objects. In the code I've excerpted below, I store map objects without difficulty, but my attempts to modify elements of the stored data don't work. struct...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.