mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Update README.md
This commit is contained in:
parent
aab31c4af2
commit
37003808e0
26
README.md
26
README.md
@ -11,17 +11,9 @@ QQ Group:225982985
|
|||||||
### 1.1 Create Connection
|
### 1.1 Create Connection
|
||||||
If you have system table permissions, use SystemTableConfig,else use AttributeConfig
|
If you have system table permissions, use SystemTableConfig,else use AttributeConfig
|
||||||
```c
|
```c
|
||||||
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
|
||||||
{ ConnectionString = Config.ConnectionString, DbType =DbType.SqlServer, IsAutoCloseConnection = true });
|
|
||||||
```
|
```
|
||||||
|
|
||||||
SystemTableConfig:
|
|
||||||
https://github.com/sunkaixuan/SqlSugar/wiki/SystemTableConfig
|
|
||||||
|
|
||||||
AttrbuteConfig
|
|
||||||
https://github.com/sunkaixuan/SqlSugar/wiki/AttributeCofnig
|
|
||||||
|
|
||||||
|
|
||||||
### 1.2 Introduction
|
### 1.2 Introduction
|
||||||
```c
|
```c
|
||||||
var getAll = db.Queryable<Student>().ToList();
|
var getAll = db.Queryable<Student>().ToList();
|
||||||
@ -321,16 +313,28 @@ catch (Exception)
|
|||||||
## 7. Use SP
|
## 7. Use SP
|
||||||
```c
|
```c
|
||||||
//1. no result
|
//1. no result
|
||||||
db.UseStoredProcedure(() =>
|
db.Ado.UseStoredProcedure(() =>
|
||||||
{
|
{
|
||||||
string spName = "sp_help";
|
string spName = "sp_help";
|
||||||
var getSpReslut = db.Ado.SqlQueryDynamic(spName, new { objname = "student" });
|
var getSpReslut = db.Ado.SqlQueryDynamic(spName, new { objname = "student" });
|
||||||
});
|
});
|
||||||
|
|
||||||
//2. has result
|
//2. has result
|
||||||
var result= db.UseStoredProcedure<dynamic>(() =>
|
var result= db.Ado.UseStoredProcedure<dynamic>(() =>
|
||||||
{
|
{
|
||||||
string spName = "sp_help";
|
string spName = "sp_help";
|
||||||
return db.Ado.SqlQueryDynamic(spName, new { objname = "student" });
|
return db.Ado.SqlQueryDynamic(spName, new { objname = "student" });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//3. has output
|
||||||
|
object outPutValue;
|
||||||
|
var outputResult = db.Ado.UseStoredProcedure<dynamic>(() =>
|
||||||
|
{
|
||||||
|
string spName = "sp_school";
|
||||||
|
var p1 = new SugarParameter("@p1", "1");
|
||||||
|
var p2= new SugarParameter("@p2", null,true);//isOutput=true
|
||||||
|
var dbResult= db.Ado.SqlQueryDynamic(spName,new SugarParameter[] {p1,p2 });
|
||||||
|
outPutValue = p2.Value;
|
||||||
|
return dbResult;
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user