예제 #1
0
        public string[] DisplayTables(string database)
        {
            ConnString conn = new ConnString();

            conn.SetDatabase(database);
            string          query      = "show tables from " + database;
            MySqlConnection connection = new MySqlConnection(conn.getConnString());
            MySqlCommand    command    = new MySqlCommand(query, connection);

            connection.Open();
            MySqlDataReader reader = command.ExecuteReader();

            List <string> rowList = new List <string>();

            while (reader.Read())
            {
                rowList.Add(reader[0].ToString());
            }

            string[] rows = new string[rowList.Count];
            for (int i = 0; i < rows.Length; i++)
            {
                rows[i] = rowList.ElementAt(i);
            }

            reader.Close();
            connection.Close();

            return(rows);
        }
예제 #2
0
 public ViewTableForm(ConnString cs, string table)
 {
     InitializeComponent();
     conn       = cs;
     this.table = table;
     DisplayTable();
 }
예제 #3
0
 public DBTablesForm(ConnString cs, string database)
 {
     InitializeComponent();
     this.database = database;
     conn          = cs;
     conn.AddDatabase(database);
     DisplayTables();
 }
예제 #4
0
 public InsertTupleForm(ConnString cs, string table)
 {
     InitializeComponent();
     conn       = cs;
     this.table = table;
     DisplayInsertPanelContents();
     PrepareTextBoxes();
 }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            string     server   = ServerTB.Text;
            string     userID   = textBox2.Text;
            string     password = textBox3.Text;
            ConnString conn     = new ConnString(server, userID, password);
            ConnectDB  connect  = new ConnectDB(conn);

            connect.connectToDBMS(conn);
        }
예제 #6
0
        public void InsertTuple(string Tblname)
        {
            ConnString      conn    = new ConnString();
            MySqlConnection connect = new MySqlConnection(conn.getConnString());

            connect.Open();
            MySqlCommand cmd = connect.CreateCommand();

            cmd.CommandText = "INSERT INTO" + Tblname + "VALUES(?,?)";
            cmd.Parameters.Add("?", MySqlDbType.VarChar).Value = "";
            cmd.Parameters.Add("?", MySqlDbType.VarChar).Value = "";
            cmd.ExecuteNonQuery();
            connect.Close();
        }
예제 #7
0
        //public string[] DisplayTable(string database, string table)
        //{
        //    ConnString conn = new ConnString();
        //    conn.SetDatabase(database);
        //    string query = "SELECT * From " + table;
        //    MySqlConnection connection = new MySqlConnection(conn.getConnString());
        //    MySqlCommand command = new MySqlCommand(query, connection);
        //    connection.Open();
        //    MySqlDataReader reader = command.ExecuteReader();

        //    List<string> rowList = new List<string>();

        //    while (reader.Read())
        //    {
        //        rowList.Add(reader[0].ToString());
        //    }

        //    string[] rows = new string[rowList.Count];
        //    for (int i = 0; i < rows.Length; i++)
        //        rows[i] = rowList.ElementAt(i);

        //    reader.Close();
        //    connection.Close();

        //    return rows;
        //}
        public void SelectTable(string database, string table)
        {
            ConnString conn = new ConnString();

            conn.SetDatabase(database);
            MySqlConnection connection = new MySqlConnection(conn.getConnString());

            connection.Open();
            bool connect = true;

            if (connect == true)
            {
                ViewTableForm veiwTable = new ViewTableForm(table);
                veiwTable.Show();
            }
        }
예제 #8
0
        public void connectToDBMS()
        {
            DatabasesForm form2   = new DatabasesForm();
            ConnString    connect = new ConnString();

            conn = new MySqlConnection();
            if (connection == false)
            {
                conn.ConnectionString = connect.getConnString();
                conn.Open();
                connection = true;
            }
            if (connection == true)
            {
                MessageBox.Show("Connection Successful");
                form2.Show();
            }
        }
예제 #9
0
        public void connectToDBMS(ConnString cs)
        {
            DatabasesForm form2   = new DatabasesForm(cs);
            ConnString    connect = cs;

            mySqlConnection = new MySqlConnection();
            if (connection == false)
            {
                mySqlConnection.ConnectionString = connect.GetConStr();
                mySqlConnection.Open();
                connection = true;
            }
            if (connection == true)
            {
                MessageBox.Show("Connection Successful");
                form2.Show();
            }
        }
예제 #10
0
        public void connectToDB(string database)
        {
            DBTablesForm form3   = new DBTablesForm(database);
            ConnString   connect = new ConnString();

            connect.SetDatabase(database);
            conn = new MySqlConnection();
            if (connection == false)
            {
                conn.ConnectionString = connect.getConnString();
                conn.Open();
                connection = true;
            }
            if (connection == true)
            {
                MessageBox.Show("Connection to Database Successful");
                form3.Show();
            }
        }
예제 #11
0
 public Tables(ConnString cs, string table)
 {
     conn       = cs;
     this.table = table;
 }
예제 #12
0
 public DatabasesForm(ConnString cs)
 {
     InitializeComponent();
     conn = cs;
 }
예제 #13
0
파일: Display.cs 프로젝트: WilliBG18/DBGray
 public Display(ConnString cs)
 {
     conn = cs;
 }
예제 #14
0
 public ConnectDB(ConnString cs)
 {
     conn = cs;
 }
예제 #15
0
파일: SQLForm.cs 프로젝트: WilliBG18/DBGray
 public SQLForm(ConnString cs)
 {
     InitializeComponent();
     conn = cs;
 }