Okay, so while I don't know exactly what you are heading for, I will just give you an example of what I did and you can take it or leave it.
A few details for you. This is an example of connecting to an Access Databse, but connections to other kinds of databases are similar in their connection strings. Look up connection strings for the correct syntax.
I also have a strongly typed DataSet called currentDataSet and a table defined that is named the same and structured the same as the database type. There are other ways of accomplishing this, but this is the way I did it:
string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sourceString;
string strSql1 = "SELECT * FROM ReportTable";
OleDbConnection con = new OleDbConnection(conString);
con.Open();
OleDbDataAdapter dAdapter = new OleDbDataAdapter();
dAdapter.SelectCommand = new OleDbCommand(strSql1, con);
dAdapter.Fill(currentDataSet, "ReportTable");
con.Close();
From there you can manipulate the data inside of the dataset. Again here is an example:
int reportTableCount = currentDataSet.ReportTable.Count();
int reportTableCounter = 0;
while (reportTableCounter < reportTableCount)
{
if (currentDataSet.ReportTable[reportTableCounter].RepParam1Value == "Bad data")
{
currentDataSet.ReportTable[reportTableCounter].RepParam1Value = "Good data";
}
reportTableCounter = reportTableCounter + 1;
}
From this point you can now update the data in the database with the following code:
con.Open();
dAdapter.SelectCommand = new OleDbCommand(strSql1, con);
OleDbCommandBuilder objCommandBuilder = new OleDbCommandBuilder(dAdapter);
dAdapter.Update(currentDataSet, "ReportTable");
con.Close();
Like I said, if none of this helps you, feel free to disregard it, you won't hurt my feelings :)