不知道连接数据库的格式 返回
const string connectionString = "server=.;uid=scott;pwd=m1234;database=pdborcl";
热忱回答(2)
-
John VIP0
2019/7/9去看demo啊
Console.WriteLine("");
Console.WriteLine("#### SqlQueryable Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
});
int total = 0;
var list = db.SqlQueryable<Student>("select * from [order]").ToPageList(1, 2, ref total);
//by expression
var list2 = db.SqlQueryable<Student>("select * from [order]").Where(it => it.Id == 1).ToPageList(1, 2);
//by sql
var list3 = db.SqlQueryable<Student>("select * from [order]").Where("id=@id", new { id = 1 }).ToPageList(1, 2);
Console.WriteLine("#### SqlQueryable End ####");
0 回复 -
John VIP0
2019/7/9最简单办法就是 你再 vs开发工具上 用vs数据库连接
然后点击你当前库 右键属性
就能看到 数据库连接字符串了 直接复制 懂么?
0 回复