Example #1
0
        public List <string> DoConn(string columnName, string sql)
        {
            string[] crDB = getDBCredentials.ReadXML();

            skrmConnString = "Server =" + crDB[0] + "; Database = " + crDB[1] + "; Uid = " + crDB[2] + "; Pwd = " + crDB[3] + ";";

            skrmDataList.Clear();
            MySqlConnection SkrmConn = new MySqlConnection(skrmConnString);

            try
            {
                SkrmConn.Open();
                MySqlCommand    Cmd = new MySqlCommand(sql, SkrmConn);
                MySqlDataReader rdr = Cmd.ExecuteReader();


                // while (rdr.Read())
                // {
                //    win.textBox1.Text = rdr.GetString(1);
                // }

                while (rdr.Read())
                {
                    //dataFromQuery += rdr.GetValue(1).ToString();
                    //skrmDataList.Add(rdr.GetValue(columnNumber).ToString());
                    skrmDataList.Add(rdr.GetString(columnName).ToString());
                }

                SkrmConn.Close();
                return(skrmDataList);
            }
            catch (Exception connErr)
            {
                MessageBox.Show(connErr.ToString());

                skrmDataList.Clear();
                return(skrmDataList);
            }
        }
Example #2
0
 private void EditXMLButton_Click(object sender, RoutedEventArgs e)
 {
     string[] x = SessionXML.ReadXML();
     MessageBox.Show(String.Format("Serwer: {0}\nBaza danych: {1}\nUser: {2}\nHasło: {3}", x[0], x[1], x[2], x[3]));
 }