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
<PackageReference Include="xy.Db.SQLServer" Version="1.0.5" />
<PackageVersion Include="xy.Db.SQLServer" Version="1.0.5" />
<PackageReference Include="xy.Db.SQLServer" />
paket add xy.Db.SQLServer --version 1.0.5
#r "nuget: xy.Db.SQLServer, 1.0.5"
#:package xy.Db.SQLServer@1.0.5
#addin nuget:?package=xy.Db.SQLServer&version=1.0.5
#tool nuget:?package=xy.Db.SQLServer&version=1.0.5
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 | Versions 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. |
-
net8.0
- System.Data.SqlClient (>= 4.9.0)
- xy.Db (>= 1.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.