📜  c# 选择 MSSQL - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:03.940000             🧑  作者: Mango

代码示例2
DataSet ds = new DataSet();
//https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/ODPNET_Core_get_started/index.html
using (SqlConnection con = new SqlConnection(connectionstr))
{
    using (SqlCommand cmd = con.CreateCommand())
    {
        con.Open();
        cmd.CommandText = "select * from master.sys.server_principals";
        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
        adapter.Fill(ds);
    }
}