在這裏我用數據庫連接數據集,但我沒有得到數據。數據沒有得到
可以請你幫我的任何錯誤在下面的代碼
string con = @"Data Source=HA-INT13\SQL2008;" + "Initial Catalog=AdventureWorks;Integrated Security=True;database=AdventureWorks;user=sa;password=sa123";
dsReports = new DataSet();
daAdapter = new SqlDataAdapter("select * from dbo.Employees",con);
SqlCommandBuilder cmdbldr = new SqlCommandBuilder(daAdapter);
daAdapter.Fill(dsReports,"dbo.Employee");
感謝, 拉哈西克哈
您是否需要打開數據庫連接? 'daAdapter.SelectCommand.Connection.Open()'?另外,您已經指定了兩次數據庫名稱,第一個是'Initial Catalog =',然後是'database =' – 2012-02-23 04:24:16