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 to login to my app with (username, password) and in combobox to chose database to show data 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;
}