I need some help...I have my app MKS
Create database MKS_2017 and using...work fine
Now I create MKS_2018 and using working fine
I need when login in my app to using (username,password) and in combox to chose database data to show in my app (MKS_2017 or MKS_2018)
I read database from server on this way:
- public List<string> GetDatabaseList()
- {
- List<string> list = new List<string>();
- using (SqlConnection con = new SqlConnection(cs))
- {
- con.Open();
- // Set up a command with the given query and associate
- // this with the current connection.
- using (SqlCommand cmd = new SqlCommand("SELECT name from sys.databases where name like 'MKS%'", con))
- {
- using (IDataReader dr = cmd.ExecuteReader())
- {
- while (dr.Read())
- {
- list.Add(dr[0].ToString());
- }
- }
- }
- }
- return list;
- }

Sai Kumar KoonaRank #334 · 7.5K reputationPosted Aug 21, 2018, 4:11 AM EDT
Goran BibicRank #993 · 2K reputationPosted Aug 21, 2018, 8:25 PM EDT
Goran BibicRank #993 · 2K reputationPosted Aug 21, 2018, 8:27 PM EDT