using IronXL;
using System.Data;
using System.Data.SqlClient;
// Your sql query
string sql = "SELECT * FROM Users";
// Your connection string
string connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=usersdb;Integrated Security=True";
using (SqlConnection connection = new SqlConnection(connectionString))
{
// Open connections to the database
connection.Open();
SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
DataSet ds = new DataSet();
// Fill DataSet with data
adapter.Fill(ds);
// Create an Excel workbook from the SQL DataSet
WorkBook workBook = WorkBook.Load(ds);
}
Imports IronXL
Imports System.Data
Imports System.Data.SqlClient
' Your sql query
Private sql As String = "SELECT * FROM Users"
' Your connection string
Private connectionString As String = "Data Source=.\SQLEXPRESS;Initial Catalog=usersdb;Integrated Security=True"
Using connection As New SqlConnection(connectionString)
' Open connections to the database
connection.Open()
Dim adapter As New SqlDataAdapter(sql, connection)
Dim ds As New DataSet()
' Fill DataSet with data
adapter.Fill(ds)
' Create an Excel workbook from the SQL DataSet
Dim workBook As WorkBook = WorkBook.Load(ds)
End Using
Install-Package IronXL.Excel
Excel aus SQL-Datenbank laden
IronXL ermöglicht die Erstellung einer Excel-Arbeitsmappe aus dem SQL-Datensatz unter Verwendung von "System.Data".