vs2005连接sql2005
SqlConnection sqlcon =new SqlConnection
( "DataSource=.\\sqlexpress;Initial Catalog=db;Integrated Security=SSPI ");
SqlDataAdapter sqlda = new SqlDataAdapter( "select * from tb ",sqlcon );
SqlCommand sqlcmd = new SqlCommand( "select * from tb ",sqlcon );
DataSet ds = new DataSet();
sqlda.Fill(ds, "pp ");
this.dataGridView1.DataSource=ds.Tables[0];
每次运行后都是出现这个错误!!!请大家帮帮忙!!!我刚接触vs2005!!!谢谢了!!!
Cannot open database "db " requested by the login. The login failed.
Login failed for user 'DEV-830966B997A\wb '.
------解决方案--------------------SQL 2005还没有用过,看看这里,有SQL2005的各种连接方式
http://www.connectionstrings.com/?carrier=sqlserver2005
------解决方案--------------------我就是那么直接联的阿,和2000一样,我觉得也就是05把企业管理器和查询分析器和并在一起了,估计你的语句有问题,按照上面说的string connectionString = "server=机器\\SQLEXPRESS;database=数据库名称;User ID=sa;password=密码 ";这么写不行吗??