S
sam345.345
Hi,
I have clarification about ADO.Net transaction and ExecuteDataset;
In the "Microsoft Data Access Application Block for .NET" project the
following code uses transaction for ExecuteDataset()
What the purpose of using transaction in the ExecuteDataset()?
I think transaction is not use when retrieving data from a DB.
public static DataSet ExecuteDataset(SqlConnection connection,
CommandType commandType, string commandText, params SqlParameter[]
commandParameters)
{
//create a command and prepare it for execution
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, connection, (SqlTransaction)null, commandType,
commandText, commandParameters);
//create the DataAdapter & DataSet
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
//fill the DataSet using default values for DataTable names, etc.
da.Fill(ds);
// detach the SqlParameters from the command object, so they can be
used again.
cmd.Parameters.Clear();
//return the dataset
return ds;
}
Please anser to my question;
sampath
I have clarification about ADO.Net transaction and ExecuteDataset;
In the "Microsoft Data Access Application Block for .NET" project the
following code uses transaction for ExecuteDataset()
What the purpose of using transaction in the ExecuteDataset()?
I think transaction is not use when retrieving data from a DB.
public static DataSet ExecuteDataset(SqlConnection connection,
CommandType commandType, string commandText, params SqlParameter[]
commandParameters)
{
//create a command and prepare it for execution
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, connection, (SqlTransaction)null, commandType,
commandText, commandParameters);
//create the DataAdapter & DataSet
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
//fill the DataSet using default values for DataTable names, etc.
da.Fill(ds);
// detach the SqlParameters from the command object, so they can be
used again.
cmd.Parameters.Clear();
//return the dataset
return ds;
}
Please anser to my question;
sampath