欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

EF Core 执行SqlServer系统默认@@命令

程序员文章站 2024-01-21 18:48:52
...
            
            using (DbConnection sqlConnection = readWriteTestContext.Database.GetDbConnection())
            {
                sqlConnection.Open();
                DbCommand sqlCommand = sqlConnection.CreateCommand();
                sqlCommand.CommandText = $"select @@SERVERNAME";
                Console.WriteLine(sqlCommand.ExecuteScalar());

            }

 

相关标签: core