LinqToSql
Posted Fred1987
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LinqToSql相关的知识,希望对你有一定的参考价值。
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConsoleApp55.Properties.Settings.mydbConnectionString"].ToString();
ConsoleApp55.DataClasses1DataContext db = new DataClasses1DataContext(connectionString);
mt2 mymt = new mt2();
mymt.id = Guid.NewGuid();
mymt.name = "SLJ";
db.mt2s.InsertOnSubmit(mymt);
db.SubmitChanges();
mt2 secondMt = db.mt2s.FirstOrDefault(x => x.name.Equals("SLJ"));
Console.WriteLine("Id={0},Name={1}", secondMt.id, secondMt.name);
Console.ReadLine();
以上是关于LinqToSql的主要内容,如果未能解决你的问题,请参考以下文章