怀疑你用了的是ODBC数据源.如果你系统的ODBC没设置好的话.不能用
Data Source=服务器名;Integrated Security=SSPI或True;Initial Catalog=数据库名;
例1、"Data Source=localhost;Integrated Security=SSPI;Initial Catalog=MySchool;“
例2、"server=KWXT-HNNOOE8KWW;database=MySchool;integrated security=sspi"
SQL Server综合验证模式:
SQL Server2000:
例1、"Data Source=(local);Initial Catalog=MySchool;UID=sa;PWD=“
例2、"Data Source=PC-200909060924;Initial Catalog=MySchool;UID=sa;PWD=“
SQL Server 2005:
例、"Data Source=PC-200909060924\\SQLEXPRESS;Initial Catalog=MySchool;User ID=sa;Password="
以上就是常见的几种数据库连接方法,希望能帮到你~!
ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=northwind;Data Source=yang "
或者
ConnectionString = "driver=;server=localhost;uid=sa;pwd=11;ConnectionTimeout=0;database=northwind "