you can use either System.Data.SqlClient.SqlConnection and other  System.Data.SqlClient.Sql* objects or System.Data.OleDb.OleDbConnection and other  System.Data.SqlClient.OleDb* objects to connect to SQL Server, but the former is optimized for Sql Server, so its performance will be better

解决方案 »

  1.   

    其实是支持三种:
    sqlclient - dot net中专为访问SQL SERVER定制的,效率最高,最推荐使用。oledb - dot net 中通用的访问支持ole db 的数据库的方式。 如果你现在用SQLSERVER,而过一段时间说不定要改用 ORACLE或其他数据库,可以使用此方式。否则用第一种方式。odbc - dot net中为访问不支持OLEDB但支持ODBC的数据库提供的访问方式。也可以访问SQLSERVER, 但不推荐使用。
      

  2.   

    sqlclient的效率是oledb的四倍,好像
      

  3.   

    sqlclient的效率是oledb的四倍,好像
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^好像是2倍哦.
      

  4.   

    string scon="data source=ServerName;initial catalog=DatabaseName;persist security info=False;user id=sa;workstation id=ServerName;packet size=4096";
    SqlConnection scon=new SqlConnection(strcon);
    scon.Open();
    ...
      

  5.   

    两种手写代码就象楼上这位,还有就是使用图形化界面工具生成,
    建议你使用ADO.net的图形化界面工具生成.
      

  6.   

    how to use ado.net?
    please!