System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet)

Here are the examples of the csharp api class System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

119 Examples 7

1. Example

Project: nHydrate
Source File: AzureCopy.cs
View license
private bool TargetIsBlank(InstallSettings settings)
		{
			var connection = new SqlConnection(settings.GetCloudConnectionString());
			var adapter = new SqlDataAdapter("select * from sys.tables", connection);
			var ds = new DataSet();
			adapter.Fill(ds);
			return (ds.Tables[0].Rows.Count == 0);
		}

2. Example

Project: nHydrate
Source File: AzureCopy.cs
View license
private bool TargetIsBlank(InstallSettings settings)
		{
			var connection = new SqlConnection(settings.GetCloudConnectionString());
			var adapter = new SqlDataAdapter("select * from sys.tables", connection);
			var ds = new DataSet();
			adapter.Fill(ds);
			return (ds.Tables[0].Rows.Count == 0);
		}

3. Example

Project: Pscx
Source File: GetOleDbDataSet.cs
View license
protected override void ProcessRecord()
        {
            try
            {
                if (!ShouldProcess(GetCommandDescription())) return;
                DataSet dataSet = new DataSet();
                OleDbDataAdapter adapter = new OleDbDataAdapter(Query, CreateConnection());
                adapter.Fill(dataSet);
                WriteObject(dataSet);
            }                        
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "GetOleDbDataSetFailed", ErrorCategory.NotSpecified, null));
            }
        }

4. Example

Project: Pscx
Source File: GetSqlDataSet.cs
View license
protected override void ProcessRecord()
        {
            try
            {
                if (!ShouldProcess(GetCommandDescription())) return;
                DataSet dataSet = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(Query, CreateConnection());
                adapter.Fill(dataSet);
                WriteObject(dataSet);
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "GetSqlDataSetFailed", ErrorCategory.NotSpecified, null));
            }
        }

5. Example

View license
public static DataSet ExecuteDataSet(this SqlCommand @this)
    {
        var ds = new DataSet();
        using (var dataAdapter = new SqlDataAdapter(@this))
        {
            dataAdapter.Fill(ds);
        }

        return ds;
    }

6. Example

View license
public static DataSet ExecuteDataSet(this SqlCeCommand @this)
    {
        var ds = new DataSet();
        using (var dataAdapter = new SqlCeDataAdapter(@this))
        {
            dataAdapter.Fill(ds);
        }

        return ds;
    }

7. Example

Project: BizUnit
Source File: DbQueryStep.cs
View license
private static DataSet FillDataSet(string connectionString, string sqlQuery)
        {
            var connection = new SqlConnection(connectionString);
            var ds = new DataSet();

            using (connection)
            {
                var adapter = new SqlDataAdapter
                                  {
                                      SelectCommand = new SqlCommand(sqlQuery, connection)
                                  };
                adapter.Fill(ds);
                return ds;
            }
        }

8. Example

Project: BizUnit
Source File: DbQueryStep.cs
View license
private static DataSet FillDataSet(string connectionString, string sqlQuery)
        {
            var connection = new SqlConnection(connectionString);
            var ds = new DataSet();

            using (connection)
            {
                var adapter = new SqlDataAdapter();
                adapter.SelectCommand = new SqlCommand(sqlQuery, connection);
                adapter.Fill(ds);
                return ds;
            }
        }

9. Example

Project: EDDiscovery
Source File: SQLiteDBClass.cs
View license
public static DataSet SQLQueryText(SQLiteConnectionED cn, DbCommand cmd)  
        {
            try
            {
                DataSet ds = new DataSet();
                DbDataAdapter da = cn.CreateDataAdapter(cmd);
                da.Fill(ds);
                return ds;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("SqlQuery Exception: " + ex.Message);
                throw;
            }
        }

10. Example

Project: SharpSCADA
Source File: MssqlFactory.cs
View license
public DataSet ExecuteDataset(string SQL)
        {
            DataSet ds = new DataSet();
            using (SqlConnection m_Conn = new SqlConnection(DataHelper.ConnectString))
            {
                try
                {
                    SqlDataAdapter da = new SqlDataAdapter();
                    SqlCommand cmd = new SqlCommand(SQL, m_Conn);
                    da.SelectCommand = cmd;
                    da.Fill(ds);
                }
                catch (Exception e)
                {
                    CallException(SQL + "        " + e.Message);
                }
            }
            return ds;
        }

11. Example

Project: Restful
Source File: SessionProvider.cs
View license
public virtual DataSet ExecuteDataSet( CommandBuilder builder )
        {
            using( DbCommand command = this.CreateSqlCommand( builder ) )
            {
                using( DbDataAdapter adapter = this.factory.CreateDataAdapter() )
                {
                    adapter.SelectCommand = command;

                    DataSet ds = new DataSet( "DataSet1" );

                    adapter.Fill( ds );

                    return ds;
                }
            }
        }

12. Example

Project: ADO.NET-DAL
Source File: Commands.cs
View license
public DataSet ExecuteDataSet(out DbCommand cmd, string commandText, params DbParameter[] parameters)
        {
            SqlCommand cmdDataSet;

            DataSet result = new DataSet();

            try
            {
                currentConnection.Open();
                cmdDataSet = BuildCommand(commandText, parameters);

                using (SqlDataAdapter adapter = new SqlDataAdapter(cmdDataSet))
                {
                    adapter.Fill(result);
                }
            }
            finally
            {
                currentConnection.Close();
            }

            cmd = cmdDataSet;
            return result;
        }

13. Example

Project: ADO.NET-DAL
Source File: SqlCommands.cs
View license
public DataSet ExecuteDataSet(out DbCommand cmd, string commandText, params DbParameter[] parameters)
        {
            SqlCommand cmdDataSet = BuildCommand(commandText, parameters);

            DataSet result = new DataSet();

            using (SqlDataAdapter adapter = new SqlDataAdapter(cmdDataSet))
            {
                adapter.Fill(result);
            }

            cmd = cmdDataSet;
            return result;
        }

14. Example

View license
protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SqlConnection conn = new SqlConnection();
                conn.ConnectionString = @"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Tie;Data Source=(local)\sqlexpress";
                conn.Open();

                if (conn.State == System.Data.ConnectionState.Open)
                {
                    DataSet ds = new DataSet();

                    SqlDataAdapter adapter = new SqlDataAdapter("SELECT ID, Slug, CreatedDate, UpdatedDate, Version FROM Page", conn);
                    adapter.Fill(ds);

                    GridView1.DataSource = ds;
                    GridView1.DataBind();
                }
            }
            catch
            {
            }
        }

15. Example

Project: Chloe
Source File: DbHelper.cs
View license
public static DataSet ExecuteDataSet(string sqlString, params SqlParameter[] cmdParams)
        {
            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand(sqlString, conn))
                {
                    if (cmdParams != null)
                    {
                        cmd.Parameters.AddRange(cmdParams);
                    }

                    DataSet ds = new DataSet();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(ds);
                    return ds;
                }
            }

        }

16. Example

Project: Tiraggo
Source File: DataProvider.cs
View license
static private tgDataResponse LoadDataSetFromText(tgDataRequest request)
        {
            tgDat/n ..... /n //View Source file for more details /n }

17. Example

Project: Tiraggo
Source File: DataProvider.cs
View license
static private tgDataResponse LoadDataSetFromStoredProcedure(tgDataRequest request)
        {
      /n ..... /n //View Source file for more details /n }

18. Example

Project: Tiraggo
Source File: DataProvider.cs
View license
static private tgDataResponse LoadDataSetFromText(tgDataRequest request)
        {
            tgDat/n ..... /n //View Source file for more details /n }

19. Example

Project: Tiraggo
Source File: DataProvider.cs
View license
static private tgDataResponse LoadDataSetFromStoredProcedure(tgDataRequest request)
        {
      /n ..... /n //View Source file for more details /n }

20. Example

Project: Tiraggo
Source File: DataProvider.cs
View license
static private tgDataResponse LoadDataSetFromText(tgDataRequest request)
        {
            tgDat/n ..... /n //View Source file for more details /n }

21. Example

Project: Tiraggo
Source File: DataProvider.cs
View license
static private tgDataResponse LoadDataSetFromStoredProcedure(tgDataRequest request)
        {
      /n ..... /n //View Source file for more details /n }

22. Example

Project: Tiraggo
Source File: DataProvider.cs
View license
static private tgDataResponse LoadDataSetFromText(tgDataRequest request)
        {
            tgDat/n ..... /n //View Source file for more details /n }

23. Example

Project: MNEnterpriseMobile
Source File: Repository.cs
View license
public Employee LoginEmployee(int employeeId) {
            Employee result = null;

            using (var connection = new SqlConnection(connectionString)) {
                using (var command = new SqlCommand("dbo.LoginEmployee", connection)) {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@EmployeeID", employeeId));
                    using (var adapter = new SqlDataAdapter(command)) {
                        using (var ds = new DataSet()) {
                            adapter.Fill(ds);
                            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) {
                                DataRow row = ds.Tables[0].Rows[0];
                                result = new Employee {
                                    EmployeeId = row.Field<int>("EmployeeID"),
                                    Name = row.Field<string>("Name"),
                                    EmailAddress = row.Field<string>("EmailAddress")
                                };
                            }
                        }
                    }
                }
            }

            return result;
        }

24. Example

Project: MNEnterpriseMobile
Source File: Repository.cs
View license
public List<Test> GetTests() {
            var result = new List<Test>();

            using (var connection = new SqlConnection(connectionString)) {
                using (var command = new SqlCommand("dbo.GetTests", connection)) {
                    command.CommandType = CommandType.StoredProcedure;
                    using (var adapter = new SqlDataAdapter(command)) {
                        using (var ds = new DataSet()) {
                            adapter.Fill(ds);
                            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) {
                                foreach (DataRow row in ds.Tables[0].Rows) {
                                    result.Add(new Test {
                                        TestId = row.Field<int>("TestID"),
                                        Title = row.Field<string>("Title"),
                                        Description = row.Field<string>("Description")
                                    });
                                }
                            }
                        }
                    }
                }
            }

            return result;
        }

25. Example

Project: fluentmigrator
Source File: JetProcessor.cs
View license
public override DataSet Read(string template, params object[] args)
        {
            EnsureConnectionIsOpen();

            var ds = new DataSet();
            using (var command = new OleDbCommand(String.Format(template, args), Connection, Transaction))
            using (var adapter = new OleDbDataAdapter(command))
            {
                adapter.Fill(ds);
                return ds;
            }
        }

26. Example

View license
public static DataSet ExecuteDataSet(this DbCommand Command, DbProviderFactory Factory)
        {
            if (Command == null)
                return null;
            Command.Open();
            using (DbDataAdapter Adapter = Factory.CreateDataAdapter())
            {
                Adapter.SelectCommand = Command;
                var ReturnSet = new DataSet();
                ReturnSet.Locale = CultureInfo.CurrentCulture;
                Adapter.Fill(ReturnSet);
                return ReturnSet;
            }
        }

27. Example

View license
public static DataSet ExecuteDataSet(this DbCommand Command, DbProviderFactory Factory)
        {
            if (Command == null)
                return null;
            Command.Open();
            using (DbDataAdapter Adapter = Factory.CreateDataAdapter())
            {
                Adapter.SelectCommand = Command;
                var ReturnSet = new DataSet();
                ReturnSet.Locale = CultureInfo.CurrentCulture;
                Adapter.Fill(ReturnSet);
                return ReturnSet;
            }
        }

28. Example

Project: fdotoolbox
Source File: OleDbPoint.cs
View license
public void ExecuteIntersectionQuery(SharpMap.Geometries.BoundingBox bbox, FeatureDataSet ds)
		{
		/n ..... /n //View Source file for more details /n }

29. Example

Project: nHydrate
Source File: SqlServers.cs
View license
internal static DataSet GetTableColumns(string connectString, string tableName)
		{
			var conn = new SqlConnection();
			var cmd = new SqlCommand();
			DataSet tableColumns = new DataSet();
			SqlDataAdapter da = new SqlDataAdapter();

			try
			{
				conn.ConnectionString = connectString;
				cmd.CommandText = GetSqlColumnsForTable(tableName);
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.Connection = conn;
				da.SelectCommand = cmd;
				da.Fill(tableColumns);
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				if (conn != null)
					conn.Close();
			}
			return tableColumns;
		}

30. Example

Project: nHydrate
Source File: DatabaseHelper.cs
View license
internal static DataSet ExecuteDataset(string connectionString, string sql)
        {
            var retVal = new DataSet();
            using (var connection = new SqlConnection(connectionString))
            {
                var command = new SqlCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = sql;
                command.Connection = connection;
                command.CommandTimeout = 300;
                var da = new SqlDataAdapter();
                da.SelectCommand = (SqlCommand)command;

                try
                {
                    da.Fill(retVal);
                    connection.Open();
                }
                catch (Exception /*ignored*/)
                {
                    throw;
                }
                finally
                {
                    if (connection.State != ConnectionState.Closed)
                    {
                        connection.Close();
                    }
                }
            }
            return retVal;
        }

31. Example

Project: nHydrate
Source File: SqlServers.cs
View license
internal static DataSet GetTableColumns(string connectString, string tableName)
		{
			SqlConnection conn = new SqlConnection();
			SqlCommand cmd = new SqlCommand();
			DataSet tableColumns = new DataSet();
			SqlDataAdapter da = new SqlDataAdapter();

			try
			{
				conn.ConnectionString = connectString;
				cmd.CommandText = GetSqlColumnsForTable(tableName);
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.Connection = conn;
				da.SelectCommand = cmd;
				da.Fill(tableColumns);
			}
			catch(Exception ex)
			{
				throw ex;
			}
			finally
			{
				if(conn != null)
					conn.Close();
			}
			return tableColumns;
		}

32. Example

Project: nHydrate
Source File: DatabaseHelper.cs
View license
public static DataSet ExecuteDataset(string connectionString, string sql)
        {
            var retVal = new DataSet();

            var connection = new SqlConnection(connectionString);
            var command = new SqlCommand();
            command.CommandType = CommandType.Text;
            command.CommandText = sql;
            command.Connection = connection;
            command.CommandTimeout = 300;
            var da = new SqlDataAdapter();
            da.SelectCommand = (SqlCommand)command;

            try
            {
                da.Fill(retVal);
                connection.Open();
            }
            catch (Exception ex)
            {
                nHydrateLog.LogError(ex);
            }
            finally
            {
                if (connection.State != ConnectionState.Closed)
                {
                    connection.Close();
                }
            }
            return retVal;
        }

33. Example

Project: nHydrate
Source File: SqlServers.cs
View license
internal static DataSet GetTableColumns(string connectString, string tableName)
        {
            var conn = new SqlConnection();
            var cmd = new SqlCommand();
            DataSet tableColumns = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();

            try
            {
                conn.ConnectionString = connectString;
                cmd.CommandText = GetSqlColumnsForTable(tableName);
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.Connection = conn;
                da.SelectCommand = cmd;
                da.Fill(tableColumns);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                    conn.Close();
            }
            return tableColumns;
        }

34. Example

Project: CarrotCakeCMS
Source File: DatabaseUpdate.cs
View license
private static DataSet GetDataSet(string sConnectionString, string sSQLQuery) {
			DataSet ds = new DataSet();

			using (SqlConnection cn = new SqlConnection(sConnectionString)) {
				using (SqlCommand cmd = new SqlCommand(sSQLQuery, cn)) {
					cn.Open();
					cmd.CommandType = CommandType.Text;
					using (SqlDataAdapter da = new SqlDataAdapter(cmd)) {
						da.Fill(ds);
					}
					cn.Close();
				}
			}

			return ds;
		}

35. Example

Project: CarrotCakeCMS-MVC
Source File: DatabaseUpdate.cs
View license
private static DataSet GetDataSet(string sConnectionString, string sSQLQuery) {
			DataSet ds = new DataSet();

			using (SqlConnection cn = new SqlConnection(sConnectionString)) {
				using (SqlCommand cmd = new SqlCommand(sSQLQuery, cn)) {
					cn.Open();
					cmd.CommandType = CommandType.Text;
					using (SqlDataAdapter da = new SqlDataAdapter(cmd)) {
						da.Fill(ds);
					}
					cn.Close();
				}
			}

			return ds;
		}

36. Example

Project: SqlProxyAndReplay
Source File: SqlRunner.cs
View license
public DataSet Execute(QueryCriteria query)
		{
			if (query == null)
				throw new ArgumentNullException(nameof(query));

			using (var connection = new SqlConnection(query.ConnectionString))
			{
				using (var command = CreateCommand(connection, query))
				{
					connection.Open();
					using (var dataAdapter = new SqlDataAdapter(command))
					{
						var dataSet = new DataSet();
						dataAdapter.Fill(dataSet);
						return dataSet;
					}
				}
			}
		}

37. Example

Project: SqlProxyAndReplay
Source File: SqlRunner.cs
View license
public DataSet Execute(QueryCriteria query)
		{
			if (query == null)
				throw new ArgumentNullException(nameof(query));

			using (var connection = new SqlConnection(query.ConnectionString))
			{
				using (var command = CreateCommand(connection, query))
				{
					connection.Open();
					using (var dataAdapter = new SqlDataAdapter(command))
					{
						var dataSet = new DataSet();
						dataAdapter.Fill(dataSet);
						return dataSet;
					}
				}
			}
		}

38. Example

Project: sensenet
Source File: SqlProvider.cs
View license
protected internal override DataSet LoadSchema()
        {
            SqlConnection cn = new SqlConnection(ConnectionStrings.ConnectionString);
            SqlCommand cmd = new SqlCommand
            {
                Connection = cn,
                CommandTimeout = Configuration.Data.SqlCommandTimeout,
                CommandType = CommandType.StoredProcedure,
                CommandText = "proc_Schema_LoadAll"
            };
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            DataSet dataSet = new DataSet();

            try
            {
                cn.Open();
                adapter.Fill(dataSet);
            }
            finally
            {
                cn.Close();
            }

            dataSet.Tables[0].TableName = "SchemaModification";
            dataSet.Tables[1].TableName = "DataTypes";
            dataSet.Tables[2].TableName = "PropertySetTypes";
            dataSet.Tables[3].TableName = "PropertySets";
            dataSet.Tables[4].TableName = "PropertyTypes";
            dataSet.Tables[5].TableName = "PropertySetsPropertyTypes";

            return dataSet;
        }

39. Example

Project: SharpMap
Source File: SqlServer2008Ex.cs
View license
public override FeatureDataRow GetFeature(uint rowId)
        {
            using (var conn = new Sq/n ..... /n //View Source file for more details /n }

40. Example

Project: cms
Source File: SqlHelper.cs
View license
public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
		{
			if( transaction == null ) throw new ArgumentNullException( "transaction" );
			if( transaction != null && transaction.Connection == null ) throw new ArgumentException( "The transaction was rollbacked or commited, please provide an open transaction.", "transaction" );

			// Create a command and prepare it for execution
			var cmd = new SqlCommand();
			var mustCloseConnection = false;
			PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection );
    			
			// Create the DataAdapter & DataSet
			using( var da = new SqlDataAdapter(cmd) )
			{
				var 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;
			}	
		}

41. Example

Project: CodeBuilder
Source File: SqlHelper.cs
View license
public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
		{
			if( transaction == null ) throw new ArgumentNullException( "transaction" );
			if( transaction != null && transaction.Connection == null ) throw new ArgumentException( "The transaction was rollbacked or commited, please provide an open transaction.", "transaction" );

			// Create a command and prepare it for execution
			SqlCommand cmd = new SqlCommand();
			bool mustCloseConnection = false;
			PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection );
    			
			// Create the DataAdapter & DataSet
			using( 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;
			}	
		}

42. Example

Project: document-management
Source File: SqlHelper.cs
View license
public static DataSet GetAllInfo(string cmdText)
        {
            DataSet set;
            SqlConnection selectConnection = new SqlConnection(strconn);
            DataSet dataSet = null;
            try
            {
                if (selectConnection.State != ConnectionState.Open)
                {
                    selectConnection.Open();
                }
                SqlDataAdapter adapter = new SqlDataAdapter(cmdText, selectConnection);
                dataSet = new DataSet();
                adapter.Fill(dataSet);
                set = dataSet;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message, exception);
            }
            finally
            {
                selectConnection.Close();
            }
            return set;
        }

43. Example

View license
public static DataSet ExecuteDataSet(this SqlConnection @this, string cmdText, SqlParameter[] parameters, CommandType commandType, SqlTransaction transaction)
    {
        using (SqlCommand command = @this.CreateCommand())
        {
            command.CommandText = cmdText;
            command.CommandType = commandType;
            command.Transaction = transaction;

            if (parameters != null)
            {
                command.Parameters.AddRange(parameters);
            }

            var ds = new DataSet();
            using (var dataAdapter = new SqlDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds;
        }
    }

44. Example

View license
public static DataSet ExecuteDataSet(this SqlConnection @this, Action<SqlCommand> commandFactory)
    {
        using (SqlCommand command = @this.CreateCommand())
        {
            commandFactory(command);

            var ds = new DataSet();
            using (var dataAdapter = new SqlDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds;
        }
    }

45. Example

View license
public static DataTable ExecuteDataTable(this SqlConnection @this, string cmdText, SqlParameter[] parameters, CommandType commandType, SqlTransaction transaction)
    {
        using (SqlCommand command = @this.CreateCommand())
        {
            command.CommandText = cmdText;
            command.CommandType = commandType;
            command.Transaction = transaction;

            if (parameters != null)
            {
                command.Parameters.AddRange(parameters);
            }

            var ds = new DataSet();
            using (var dataAdapter = new SqlDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds.Tables[0];
        }
    }

46. Example

View license
public static DataTable ExecuteDataTable(this SqlConnection @this, Action<SqlCommand> commandFactory)
    {
        using (SqlCommand command = @this.CreateCommand())
        {
            commandFactory(command);

            var ds = new DataSet();
            using (var dataAdapter = new SqlDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds.Tables[0];
        }
    }

47. Example

View license
public static DataSet ExecuteDataSet(this SqlCeConnection @this, string cmdText, SqlCeParameter[] parameters, CommandType commandType, SqlCeTransaction transaction)
    {
        using (SqlCeCommand command = @this.CreateCommand())
        {
            command.CommandText = cmdText;
            command.CommandType = commandType;
            command.Transaction = transaction;

            if (parameters != null)
            {
                command.Parameters.AddRange(parameters);
            }

            var ds = new DataSet();
            using (var dataAdapter = new SqlCeDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds;
        }
    }

48. Example

View license
public static DataSet ExecuteDataSet(this SqlCeConnection @this, Action<SqlCeCommand> commandFactory)
    {
        using (SqlCeCommand command = @this.CreateCommand())
        {
            commandFactory(command);

            var ds = new DataSet();
            using (var dataAdapter = new SqlCeDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds;
        }
    }

49. Example

View license
public static DataTable ExecuteDataTable(this SqlCeConnection @this, string cmdText, SqlCeParameter[] parameters, CommandType commandType, SqlCeTransaction transaction)
    {
        using (SqlCeCommand command = @this.CreateCommand())
        {
            command.CommandText = cmdText;
            command.CommandType = commandType;
            command.Transaction = transaction;

            if (parameters != null)
            {
                command.Parameters.AddRange(parameters);
            }

            var ds = new DataSet();
            using (var dataAdapter = new SqlCeDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds.Tables[0];
        }
    }

50. Example

View license
public static DataTable ExecuteDataTable(this SqlCeConnection @this, Action<SqlCeCommand> commandFactory)
    {
        using (SqlCeCommand command = @this.CreateCommand())
        {
            commandFactory(command);

            var ds = new DataSet();
            using (var dataAdapter = new SqlCeDataAdapter(command))
            {
                dataAdapter.Fill(ds);
            }

            return ds.Tables[0];
        }
    }