Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
a4u6178
Starting Member
11 Posts |
Posted - 2011-07-30 : 01:18:15
|
Hello everyone,Is there any way to know all database names existing in sql server.Looking forward for replys...Thanks & Regards, |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
a4u6178
Starting Member
11 Posts |
Posted - 2011-07-30 : 02:00:32
|
thanks for immediate replys..I was trying to bring all the database names in a dropdownlist..Here is my code .. protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { populateddl(); } } private void populateddl() { using (SqlDataAdapter sda = new SqlDataAdapter("exec sp_databases", conn)) { using(DataSet ds = new DataSet()) { sda.Fill(ds); DropDownList8.DataSource = ds; DropDownList8.DataBind(); } } }em not able to get the names in the dropdownlist, pls help me in this scenario..when run the application what em getting is.. system.data.datarowviewas items of dropdownlist instead of this i should get names of databasesLooking forward for ur replysThanks & Regards, |
|
|
a4u6178
Starting Member
11 Posts |
Posted - 2011-08-04 : 05:40:38
|
To bind dropdownllist i modified the code like this ..DropDownList8.DataTextField = "DATABASE_NAME";DropDownList8.DataValueField = "DATABASE_SIZE";Thanks & Regards, |
|
|
|
|
|