public void UseDataAdapter(SalesforceConnection salesforceConnection)
{
SalesforceDataAdapter myAdapter = new SalesforceDataAdapter("SELECT Name FROM Account", salesforceConnection);
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet myDataSet = new DataSet();
myAdapter.Fill(myDataSet,"Accounts");
object[] rowVals = new object[2];
rowVals[0] = "New account";
myDataSet.Tables["Accounts"].Rows.Add(rowVals);
myAdapter.InsertCommand = new SalesforceCommand("INSERT INTO Account (Name) " +
"VALUES ( :Name)", salesforceConnection);
myAdapter.InsertCommand.Parameters.Add("Name", SalesforceType.String, 255, "Name");
myAdapter.Update(myDataSet,"Account");
//Get all data from all tables within the dataset
foreach(DataTable myTable in myDataSet.Tables)
{
foreach(DataRow myRow in myTable.Rows)
{
foreach (DataColumn myColumn in myTable.Columns)
{
Console.Write(myRow[myColumn]+"\t");
}
Console.WriteLine();
}
Console.WriteLine();
}
}