using (con = new SqlConnection("Data Source=" + txtServerName.Text + "; Integrated Security=True;")) { con.Open(); DataTable databases = con.GetSchema("Databases"); List<ServerDatabseDetails> svrDBDetails = new List<ServerDatabseDetails>(); ServerDatabseDetails svrDBDetail; foreach (DataRow database in databases.Rows) { svrDBDetail = new ServerDatabseDetails(); svrDBDetail.DBName = database.Field<String>("database_name"); svrDBDetail.DBID = database.Field<short>("dbid"); svrDBDetail.CreationDate = database.Field<DateTime>("create_date"); svrDBDetails.Add(svrDBDetail); } con.Close(); } // Out come :- All database name and ID. Required only share point database details.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)