xy.Db.SQLServer 1.0.5

dotnet add package xy.Db.SQLServer --version 1.0.5
                    
NuGet\Install-Package xy.Db.SQLServer -Version 1.0.5
                    
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="xy.Db.SQLServer" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="xy.Db.SQLServer" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="xy.Db.SQLServer" />
                    
Project file
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 xy.Db.SQLServer --version 1.0.5
                    
#r "nuget: xy.Db.SQLServer, 1.0.5"
                    
#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.
#:package xy.Db.SQLServer@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=xy.Db.SQLServer&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=xy.Db.SQLServer&version=1.0.5
                    
Install as a Cake Tool

xy Db SQLServer Implement

xy.Db is a definition of general database operation interface and implementation of specific database operations for each database, Currently includes: SQLite64, PostgreSQL, SqlServer, MySql
This project is a SQLServer implementation of xy.Db.

Sample

Please read code details in project xyDbSample.

Create DbService

IDbAccess dbAccess = new SQLServerDbAccess();
string ConnectionString = @"Server=localhost\SQLEXPRESS;uid=testUser;pwd=testPassword;database=testDb;Packet Size=8192;Max Pool Size=1000;Connect Timeout=30;";
DbService = new DbService(ConnectionString, dbAccess);
await DbService.openAsync();

New record and query

maxId++;
string sql = "INSERT INTO COMPANY(ID, NAME, AGE) " + "VALUES(" + maxId + ", '', 0)";
await dbService.exeSqlAsync(sql);
sql = "SELECT * From COMPANY WHERE ID=" + maxId;
DataTable dt = await dbService.exeSqlForDataSetAsync(sql);
int i = dataGridView1.Rows.Add(dt.Rows[0].ItemArray);
dataGridView1.Rows[i].Tag = dt.Rows[0];

Edit record

string colName = dataGridView1.Columns[e.ColumnIndex].Name;
string cellValue = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
string rowID = dataGridView1.Rows[e.RowIndex].Cells["ID"].Value.ToString();
string sql = "UPDATE COMPANY SET " + colName + "='" + cellValue + "' " + " WHERE ID=" + rowID;
await dbService.exeSqlAsync(sql);

Delete record

int rowIndex = dataGridView1.SelectedRows[0].Index;
int rowID = Convert.ToInt32(dataGridView1.Rows[rowIndex].Cells["ID"].Value);
string sql = "DELETE FROM COMPANY " + " WHERE ID=" + rowID;
await dbService.exeSqlAsync(sql);
dataGridView1.Rows.RemoveAt(rowIndex);

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.5 247 4/17/2025
1.0.4 238 4/16/2025
1.0.3 230 4/14/2025
1.0.2 228 4/14/2025