SqlConnection cnn = new SqlConnection("server=.;uid=用户名;pwd=密码;database=数据库名");SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM TABLENAME",cnn);DataSet ds = new DataSet();sda.Fill(ds,"TABLENAME");
去这看看。http://www.connectionstrings.com/