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
0
1. Example
View licenseprivate 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); }
0
2. Example
View licenseprivate 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); }
0
3. Example
View licenseprotected 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)); } }
0
4. Example
View licenseprotected 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)); } }
0
5. Example
View licensepublic static DataSet ExecuteDataSet(this SqlCommand @this) { var ds = new DataSet(); using (var dataAdapter = new SqlDataAdapter(@this)) { dataAdapter.Fill(ds); } return ds; }
0
6. Example
View licensepublic static DataSet ExecuteDataSet(this SqlCeCommand @this) { var ds = new DataSet(); using (var dataAdapter = new SqlCeDataAdapter(@this)) { dataAdapter.Fill(ds); } return ds; }
0
7. Example
View licenseprivate 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; } }
0
8. Example
View licenseprivate 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; } }
0
9. Example
View licensepublic 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; } }
0
10. Example
View licensepublic 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; }
0
11. Example
View licensepublic 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; } } }
0
12. Example
View licensepublic 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; }
0
13. Example
View licensepublic 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; }
0
14. Example
View licenseprotected 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 { } }
0
15. Example
View licensepublic 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; } } }
0
16. Example
View licensestatic private tgDataResponse LoadDataSetFromText(tgDataRequest request) { tgDat/n ..... /n //View Source file for more details /n }
0
17. Example
View licensestatic private tgDataResponse LoadDataSetFromStoredProcedure(tgDataRequest request) { /n ..... /n //View Source file for more details /n }
0
18. Example
View licensestatic private tgDataResponse LoadDataSetFromText(tgDataRequest request) { tgDat/n ..... /n //View Source file for more details /n }
0
19. Example
View licensestatic private tgDataResponse LoadDataSetFromStoredProcedure(tgDataRequest request) { /n ..... /n //View Source file for more details /n }
0
20. Example
View licensestatic private tgDataResponse LoadDataSetFromText(tgDataRequest request) { tgDat/n ..... /n //View Source file for more details /n }
0
21. Example
View licensestatic private tgDataResponse LoadDataSetFromStoredProcedure(tgDataRequest request) { /n ..... /n //View Source file for more details /n }
0
22. Example
View licensestatic private tgDataResponse LoadDataSetFromText(tgDataRequest request) { tgDat/n ..... /n //View Source file for more details /n }
0
23. Example
View licensepublic 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; }
0
24. Example
View licensepublic 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; }
0
25. Example
View licensepublic 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; } }
0
26. Example
View licensepublic 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; } }
0
27. Example
View licensepublic 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; } }
0
28. Example
View licensepublic void ExecuteIntersectionQuery(SharpMap.Geometries.BoundingBox bbox, FeatureDataSet ds) { /n ..... /n //View Source file for more details /n }
0
29. Example
View licenseinternal 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; }
0
30. Example
View licenseinternal 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; }
0
31. Example
View licenseinternal 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; }
0
32. Example
View licensepublic 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; }
0
33. Example
View licenseinternal 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; }
0
34. Example
View licenseprivate 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; }
0
35. Example
View licenseprivate 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; }
0
36. Example
View licensepublic 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; } } } }
0
37. Example
View licensepublic 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; } } } }
0
38. Example
View licenseprotected 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; }
0
39. Example
View licensepublic override FeatureDataRow GetFeature(uint rowId) { using (var conn = new Sq/n ..... /n //View Source file for more details /n }
0
40. Example
View licensepublic 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; } }
0
41. Example
View licensepublic 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; } }
0
42. Example
View licensepublic 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; }
0
43. Example
View licensepublic 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; } }
0
44. Example
View licensepublic 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; } }
0
45. Example
View licensepublic 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]; } }
0
46. Example
View licensepublic 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]; } }
0
47. Example
View licensepublic 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; } }
0
48. Example
View licensepublic 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; } }
0
49. Example
View licensepublic 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]; } }
0
50. Example
View licensepublic 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]; } }