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
sqlclient - dot net中专为访问SQL SERVER定制的,效率最高,最推荐使用。oledb - dot net 中通用的访问支持ole db 的数据库的方式。 如果你现在用SQLSERVER,而过一段时间说不定要改用 ORACLE或其他数据库,可以使用此方式。否则用第一种方式。odbc - dot net中为访问不支持OLEDB但支持ODBC的数据库提供的访问方式。也可以访问SQLSERVER, 但不推荐使用。
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^好像是2倍哦.
SqlConnection scon=new SqlConnection(strcon);
scon.Open();
...
建议你使用ADO.net的图形化界面工具生成.
please!