Пример #1
0
        private void btnGetAllTable_Click(object sender, EventArgs e)
        {
            lvwTable.Items.Clear();

            OleDbConnection conn = GetConn();

            string sql = "select [name],[id] from [sysobjects] where [type] = 'u' order  by name";

            OleDbDataAdapter adapter = new OleDbDataAdapter(sql, conn);
            DataSet          ds      = new DataSet();

            adapter.Fill(ds);
            DataTable dt = ds.Tables[0];

            conn.Close();

            foreach (DataRow dr in dt.Rows)
            {
                string tableName = Convert.ToString(dr[0]);
                if (!string.IsNullOrEmpty(tableName))
                {
                    ListViewItem lvItem = new ListViewItem();
                    lvItem.Text = tableName;

                    ACTable at = new ACTable();
                    at.Name    = tableName;
                    at.Id      = Convert.ToString(dr[1]);
                    lvItem.Tag = at;

                    lvwTable.Items.Add(lvItem);
                }
            }
        }
Пример #2
0
        private void btnGetAllTable_Click(object sender, EventArgs e)
        {
            lvwTable.Items.Clear();
         
            OleDbConnection conn = GetConn();
           
            string sql = "select [name],[id] from [sysobjects] where [type] = 'u' order  by name";

            OleDbDataAdapter adapter = new OleDbDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            adapter.Fill(ds);
            DataTable dt = ds.Tables[0];

            conn.Close();

            foreach (DataRow dr in dt.Rows)
            {
                string tableName = Convert.ToString(dr[0]);
                if (!string.IsNullOrEmpty(tableName))
                {
                    ListViewItem lvItem = new ListViewItem();
                    lvItem.Text = tableName;

                    ACTable at = new ACTable();
                    at.Name = tableName;
                    at.Id = Convert.ToString(dr[1]);
                    lvItem.Tag = at;

                    lvwTable.Items.Add(lvItem);
                }
            }
        }
Пример #3
0
        private void btnGetAllTable_Click(object sender, EventArgs e)
        {
            lvwTable.Items.Clear();

            MySqlConnection conn = GetConn();

            string DB  = txtDB.Text;
            string sql = "select table_name from INFORMATION_SCHEMA.TABLES Where table_schema = '" + DB + "' ";

            MySqlCommand cmd = new MySqlCommand(sql, conn);

            MySqlDataAdapter adapter = new MySqlDataAdapter(sql, conn);
            DataSet          ds      = new DataSet();

            adapter.Fill(ds);
            DataTable dt = ds.Tables[0];

            conn.Close();

            foreach (DataRow dr in dt.Rows)
            {
                string tableName = Convert.ToString(dr[0]);
                if (!string.IsNullOrEmpty(tableName))
                {
                    ListViewItem lvItem = new ListViewItem();
                    lvItem.Text = tableName;

                    ACTable at = new ACTable();
                    at.Name         = tableName;
                    at.DatabaseName = DB;
                    //at.Id = Convert.ToString(dr[1]);
                    lvItem.Tag = at;

                    lvwTable.Items.Add(lvItem);
                }
            }
        }
Пример #4
0
        private void btnGetAllTable_Click(object sender, EventArgs e)
        {
            lvwTable.Items.Clear();

            MySqlConnection conn = GetConn();

            string DB = txtDB.Text;
            string sql = "select table_name from INFORMATION_SCHEMA.TABLES Where table_schema = '" + DB + "' ";

            MySqlCommand cmd = new MySqlCommand(sql, conn);            

            MySqlDataAdapter adapter = new MySqlDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            adapter.Fill(ds);
            DataTable dt = ds.Tables[0];

            conn.Close();

            foreach (DataRow dr in dt.Rows)
            {
                string tableName = Convert.ToString(dr[0]);
                if (!string.IsNullOrEmpty(tableName))
                {
                    ListViewItem lvItem = new ListViewItem();
                    lvItem.Text = tableName;

                    ACTable at = new ACTable();
                    at.Name = tableName;
                    at.DatabaseName = DB;
                    //at.Id = Convert.ToString(dr[1]);
                    lvItem.Tag = at;

                    lvwTable.Items.Add(lvItem);
                }
            }
        }