wfsql 1.4.0
dotnet add package wfsql --version 1.4.0
NuGet\Install-Package wfsql -Version 1.4.0
<PackageReference Include="wfsql" Version="1.4.0" />
paket add wfsql --version 1.4.0
#r "nuget: wfsql, 1.4.0"
// Install wfsql as a Cake Addin
#addin nuget:?package=wfsql&version=1.4.0
// Install wfsql as a Cake Tool
#tool nuget:?package=wfsql&version=1.4.0
WFSQL
WFSQL is a simple library to simplify working with a SQL Server database in a C# Windows Forms application
About this library
The library includes classes with methods that can be used for:
- Filling the DataGridView with data obtained from the database using SELECT queries
- Filling the ComboBox with data obtained from the database using SELECT queries
- Performing INSERT, DELETE and UPDATE queries to the database
The library includes interface with method that can be used to:
- Notify the parent form of an event in the child form
How to use this library:
To get started, install this library using PackageManager:
Install-Package wfsql -Version 1.4.0
Or using .NET CLI:
dotnet add package wfsql --version 1.4.0
After installing the NuGet package, you can use the Database
class to work with the database.
First, create an instance of the Database
class by passing the database connection string as a parameter to its constructor:
private Database database = new Database(@"Data Source=SOME\SQLDATASOURCE;Initial Catalog=SomeDatabase;User ID=SomeUser;Password=SomePassword");
To fill the DataGridView with values from the database, you can use the FillDataGridView
method:
database.FillDataGridView("SELECT * FROM SomeTable", someDataGridView);
To fill the ComboBox with values from the database, you can use the FillComboBox
method:
database.FillComboBox("SELECT SomeId, SomeName FROM SomeTable", someComboBox, "SomeId", "SomeName");
To perform an INSERT, DELETE or UPDATE query to the database, you can use the ExecuteSqlQuery
method:
database.ExecuteSqlQuery("INSERT INTO SomeTable(SomeId, SomeName) VALUES (1, 'NameOfUserWithId1')");
database.ExecuteSqlQuery("UPDATE SomeTable SET SomeName = 'UpdatedName' WHERE SomeId = 1");
database.ExecuteSqlQuery("DELETE FROM SomeTable WHERE SomeId = 1");
The source code of this library can be found on GitHub. An example of a Windows Forms application using the classes of this library is presented in the sample folder in the Github repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
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.