string strConnection = "Data Source=localhost;Database=dbname;Uid=sa;Pwd=111;Provider=SQLOLEDB";
string strConnection = "Provider=sqloledb;Data Source=20090202-1745;Initial Catalog=dbname;User Id=sa;Password=111;";

基本上用到的都是连本机的sqlserver数据库,但用localhost老是出错,必须用sqlserver的实例名称才行,这样每次都要修改,麻烦。
今天试验了半天,发现要用本机的默认sqlserver实例的话,可以把data source或者server等去掉即可。

相关文章:

  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
  • 2021-10-01
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-14
  • 2021-11-28
  • 2021-12-29
  • 2022-01-15
  • 2022-12-23
相关资源
相似解决方案