Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataTable/DataSet Question
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
DataTable/DataSet Question
Miscellaneous
Thread ID:
01216542
Message ID:
01216542
Views:
63
I'm not sure how to ask this as I'm a newby at ADO.Net, so this is a bit long.

I created a DataTable with:
// Create a DB factory
DbProviderFactory oDataFactory = 
	DbProviderFactories.GetFactory(this._sProviderType);

// Get a connection object from the factory
DbConnection oConnection = oDataFactory.CreateConnection();
oConnection.ConnectionString = sConnectionString;

// Get a command object from the factory
DbCommand oCommand = oDataFactory.CreateCommand();
oCommand.CommandText = sQuery;
oCommand.Connection = oConnection;

// Get a data adapter from the factory
DbDataAdapter oDataAdapter = oDataFactory.CreateDataAdapter();
oDataAdapter.SelectCommand = oCommand;

// Create the data table and fill it
DataTable oDataTable = new DataTable(sCursorName);
oDataAdapter.Fill(oDataTable);

// Copy the table to the return variable
oRetVal = oDataTable;
This works really well with no problems. I have then bound the instance of the DataTable
to a DataGrid. Again, all is well so far.

Now that I can modify data, how do I send changes back to the data source. So far I have:
public bool UpdateData(DataTable oDataTable)
{
    // Declare variables
    bool bRetVal = true;

    // Create a dataset of changes
    DataTable oChanges = oDataTable.GetChanges(DataRowState.Modified);

    // If any rows exist in the changes cursor...
    if (oChanges.Rows.Count > 0)
    {

        // WHAT GOES HERE???
    }

    return bRetVal;
}
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform