zoukankan      html  css  js  c++  java
  • C# ado.net oledb方式连接(三)

    oledb 方式连接

     1   class Program
     2     {
     3         private static string constr = "server=.;database=northwnd;integrated security=sspi";
     4         static void Main(string[] args)
     5         {
     6             string source = "provider=sqloledb;" + constr;
     7             string select = "select contactname,companyname from customers";
     8             OleDbConnection con = new OleDbConnection(source);
     9             con.Open();
    10             OleDbCommand cmd = new OleDbCommand(select, con);
    11             OleDbDataReader reader = cmd.ExecuteReader();
    12             while (reader.Read())
    13                 Console.WriteLine("{0} from {1}", reader.GetString(0), reader.GetString(1));
    14             reader.Close();
    15             con.Close();
    16         }
    17 
    18     }
  • 相关阅读:
    vim python extension
    aws msk
    Install python3
    sns
    inventory
    批量添加监听端口
    template screen
    DNS name
    add jar and proxy repo
    模型诊断论文心得
  • 原文地址:https://www.cnblogs.com/farmer-y/p/6253220.html
Copyright © 2011-2022 走看看