KmbAdoHelper 2.2.15
dotnet add package KmbAdoHelper --version 2.2.15
NuGet\Install-Package KmbAdoHelper -Version 2.2.15
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KmbAdoHelper" Version="2.2.15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KmbAdoHelper" Version="2.2.15" />
<PackageReference Include="KmbAdoHelper" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KmbAdoHelper --version 2.2.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: KmbAdoHelper, 2.2.15"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=KmbAdoHelper&version=2.2.15
#tool nuget:?package=KmbAdoHelper&version=2.2.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ado-Net-Helper
SQL Sorgularını çalıştırabileceğiniz ve sonuçlarını listeleyebileceğiniz bir yardımcı ADO.NET kütüphanesidir.
Build server | Name | Framework | Status |
---|---|---|---|
AppVeyor | AdoNetHelper | NET Framework 4.8.1 | |
AppVeyor | AdoNetHelperCore | NET 9 | |
Code-Samples
Creating Database Object
// Create instance for Database object.
Database DB = new Database(ConnectionString);
How to use RunQuery method
// RunQuery method runs queries. Return affected row count value.
int result =
DB.RunQuery("INSERT INTO Books(Name, Author, Description, Price) VALUES(@Name, @Author, @Desc, @Price)",
new ParamItem() { ParamName = "@Name", ParamValue = "Jungle Book" },
new ParamItem() { ParamName = "@Author", ParamValue = "K. Murat Başeren" },
new ParamItem() { ParamName = "@Desc", ParamValue = "About book subject" },
new ParamItem() { ParamName = "@Price", ParamValue = 25 });
// Shows affected row count in output window.
Debug.WriteLine("Affected row(s) count (RunQuery - Insert) : " + result);
How to use GetTable method
// Get Datatable with sql datas
// I use generic ParamItem<T>
DataTable dt =
DB.GetTable("SELECT Id, Name, Author, Description, Price FROM Books WHERE Price > @PriceVal",
new ParamItem() { ParamName = "@PriceVal", ParamValue = 25m });
// Shows rows count in output window.
Debug.WriteLine("Result table row count(RunQuery - GetTable) : " + dt.Rows.Count);
How to use RunScalar method
// Execute scalar query and convert result
int bookCount = DB.RunScalar<int>("SELECT COUNT(*) FROM Books");
// Execute scalar query async and convert result
int bookCount = await DB.RunScalarAsync<int>("SELECT COUNT(*) FROM Books");
How to use RunProc method
Create sample stored procedures
-- Add MyStoredProc1 and MyStoredProc2 sample procedures..
-- Sample Procedures DDLs
CREATE PROCEDURE MyStoredProc1
@MinPrice decimal(18,2),
@MaxPrice decimal(18,2)
AS
BEGIN
SELECT [Id], [Name], [Author], [Description], [Price]
FROM Books
WHERE Price > @MinPrice AND Price < @MaxPrice
END
GO
CREATE PROCEDURE MyStoredProc2
@NewPrice decimal(18,2)
AS
BEGIN
UPDATE Books SET Price = @NewPrice
WHERE Author LIKE '%Charles%'
END
GO
Using RunProc method
// After...
// Get Table..
DataTable dt = DB.RunProc("MyStoredProc1",
new ParamItem() { ParamName = "@MinPrice", ParamValue = 20m },
new ParamItem() { ParamName = "@MaxPrice", ParamValue = 25m });
// Shows rows count in output window.
Debug.WriteLine("Result table row count(RunProc - MyStoredProc1) : " + dt.Rows.Count);
// No return value..
DB.RunProc("MyStoredProc2",
new ParamItem() { ParamName = "@NewPrice", ParamValue = 29m });
Async usage
// Example of using async methods
int affectedRows = await DB.RunQueryAsync(
"INSERT INTO Books(Name, Author, Description, Price) VALUES(@Name, @Author, @Desc, @Price)",
new ParamItem() { ParamName = "@Name", ParamValue = "Jungle Book" },
new ParamItem() { ParamName = "@Author", ParamValue = "K. Murat Başeren" },
new ParamItem() { ParamName = "@Desc", ParamValue = "About book subject" },
new ParamItem() { ParamName = "@Price", ParamValue = 25 });
DataTable asyncTable = await DB.GetTableAsync(
"SELECT Id, Name, Author, Description, Price FROM Books WHERE Price > @PriceVal",
new ParamItem() { ParamName = "@PriceVal", ParamValue = 25m });
RunFunction usage
// Example of calling a SQL function that returns table
DataTable fnTable = DB.RunFunction("dbo.GetBooksByPrice",
new ParamItem() { ParamName = "@MinPrice", ParamValue = 10m },
new ParamItem() { ParamName = "@MaxPrice", ParamValue = 20m });
// Async version
DataTable asyncFnTable = await DB.RunFunctionAsync("dbo.GetBooksByPrice",
new ParamItem() { ParamName = "@MinPrice", ParamValue = 10m },
new ParamItem() { ParamName = "@MaxPrice", ParamValue = 20m });
Export sınıfı kullanımı
// DataTable verisini PDF dosyasına dönüştürme
Export exporter = new Export();
byte[] pdfBytes = await exporter.ToPdfAsync(dt);
File.WriteAllBytes(@"C:\\temp\\table.pdf", pdfBytes);
// DataTable verisini HTML dosyasına dönüştürme
byte[] htmlBytes = await exporter.ToHtmlAsync(dt);
File.WriteAllBytes(@"C:\\temp\\table.html", htmlBytes);
// DataTable verisini CSV dosyasına dönüştürme
byte[] csvBytes = await exporter.ToCsvAsync(dt);
File.WriteAllBytes(@"C:\\temp\\table.csv", csvBytes);
Backup ve Restore metodları
// Veritabanı yedeği oluşturma
DB.Backup("BookDb", @"C:\\temp\\BookDb.bak");
// Yedekten veritabanını geri yükleme
DB.Restore("BookDb", @"C:\\temp\\BookDb.bak");
// Async kullanımı
await DB.BackupAsync("BookDb", @"C:\\temp\\BookDb.bak");
await DB.RestoreAsync("BookDb", @"C:\\temp\\BookDb.bak");
Tablo klonlama metodları
// Yapı kopyası oluşturma (veri olmadan)
await DB.CloneTableStructureAsync("Books", "BooksCopy");
// Yapı ve verilerle beraber kopya oluşturma
await DB.CloneTableWithDataAsync("Books", "BooksCopyWithData");
Transaction kullanımı (Henüz Test Edilmedi !!)
// Transaction başlatma
await DB.BeginTransactionAsync();
try
{
DB.RunQuery("UPDATE Books SET Price = Price + 1");
DB.RunQuery("INSERT INTO Logs(Message) VALUES(@msg)",
new ParamItem() { ParamName = "@msg", ParamValue = "Prices updated" });
DB.Commit();
}
catch
{
DB.Rollback();
throw;
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.2.15 | 58 | 6/20/2025 |
2.2.13 | 66 | 6/20/2025 |
2.2.12 | 277 | 6/12/2025 |
2.2.11 | 275 | 6/12/2025 |
2.2.10 | 275 | 6/11/2025 |
2.2.7 | 274 | 6/11/2025 |
2.2.6 | 271 | 6/11/2025 |
2.2.5 | 273 | 6/11/2025 |
2.2.4 | 301 | 6/11/2025 |
2.2.3 | 1,367 | 10/15/2017 |
2.2.2 | 1,102 | 10/15/2017 |
2.2.0 | 1,267 | 10/27/2016 |
2.1.7 | 1,195 | 8/16/2016 |
2.1.6 | 1,605 | 8/16/2016 |
2.1.0 | 1,161 | 8/15/2016 |
2.0.0 | 1,664 | 8/5/2016 |
1.0.0 | 1,239 | 8/5/2016 |