Click here to Skip to main content
12,350,605 members (25,993 online)
Click here to Skip to main content
Articles » Database » Database » SQL Server » Downloads

Tagged as

Stats

10.4K views
419 downloads
7 bookmarked
Posted

Using SQL Server Metadata and Statistics to Build a Table Explorer Application

, 1 Oct 2012 CPOL
Develops an analogy between database table and file directory information and argues that it could be very useful if it were possible to have a similar application to Windows Explorer for database tables. Demonstrates how to obtain the information from Sql Server system tables and dynamic management
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DbView
{
	public partial class DatabaseSelectionForm : Form
	{
		String m_DatabaseSelectedOnOk = ""; 
		public DatabaseSelectionForm(List<String>DatabaseNames, String CurrentName)
		{
			InitializeComponent();
			
			foreach (String dbName in DatabaseNames)
			{
				this.listDatabases.Items.Add(dbName);
			}
			this.listDatabases.SelectedIndex = listDatabases.Items.IndexOf(CurrentName);
			if (this.listDatabases.SelectedIndex == -1)
				this.listDatabases.SelectedIndex = 0;
		}
		
		public String SelectedDatabase
		{
			get { return m_DatabaseSelectedOnOk; }
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			m_DatabaseSelectedOnOk = listDatabases.Items[listDatabases.SelectedIndex].ToString();
			this.DialogResult = DialogResult.OK;
			this.Close();
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.Cancel;
			this.Close();
		}

		private void listDatabases_DoubleClick(object sender, EventArgs e)
		{
			this.btnOk_Click(sender, e);
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

DaveDbViewSharp
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 1 Oct 2012
Article Copyright 2012 by DaveDbViewSharp
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid