https://github.com/ovichowdhury/sql-client-repository
SQL client repository is an ado.net SQL client wrapper for convenient access of SQL server database using c#.
https://github.com/ovichowdhury/sql-client-repository
csharp sql-client sql-server
Last synced: 3 months ago
JSON representation
SQL client repository is an ado.net SQL client wrapper for convenient access of SQL server database using c#.
- Host: GitHub
- URL: https://github.com/ovichowdhury/sql-client-repository
- Owner: ovichowdhury
- Created: 2018-03-27T18:01:14.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-18T17:41:30.000Z (almost 7 years ago)
- Last Synced: 2025-01-08T07:35:25.021Z (5 months ago)
- Topics: csharp, sql-client, sql-server
- Language: C#
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sql-Client-Repository
SQL client repository is an ado.net SQL client wrapper for convenient access of SQL server database using c#.## Features
1. Easy to use interface for interacting with sql server database.
2. No need to write any ADO.NET code for executing query in the sql server database.
3. Return's query result in list format therefore accessing database values in c# become very easy.## Integration
1. Download the Sql-Client-Repository/SqlClientRepository/bin/Release/SqlClientRepository.dll class library.
2. Add this class library in the reference section of your project.## Examples
```
// Create an instance of SqlClientWrapper class and pass the connection string as constructor parameterISqlClientWrapper db = new SqlClientWrapper("server=.; database=YOUR_DATABASE_NAME; integrated security=SSPI");
// for executing any query just call Execute(sqlQuery) method from SqlClientWrapper class
string sql = "CREATE TABLE Persons (PersonID int,LastName varchar(255),FirstName varchar(255),Address varchar(255),City varchar(255) );" ;
db.Execute(sql);
// for executing a query with parameter value
string sql = "UPDATE persons SET FirstName = @name WHERE PersonId = @id";
var parameters = new Dictionary(){ {"name", "Nahid chowdhury"}, {"id", 5} };
int numOfRowEffected = db.Execute(sql, parameters);
// for retrieving value from database tables
string sql = "SELECT * FROM Persons WHERE PersonID = @id";
var param = new Dictionary(){ {"id", 5} };
var result = db.Select(sql, param); // the result is a list of dictionaries where each dictionary represents a row of database table
// for example we want to access the FirstName of first row
string firstName = result[0]["FirstName"];
```