Example #1
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            string    tungay  = dtpTuNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
            string    denngay = dtpDenNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
            ClsOracle clsora  = new ClsOracle();
            DataTable dt      = new DataTable();

            clsora.ClsConnect();
            string tk = str.Left(cboTk.SelectedValue.ToString().Trim(), 10);
            //MessageBox.Show(tk);

            string sql = "select to_char(a.ngaygd,'dd/MM/yyyy') as NGGD,c.AC_DESC as TENTK,a.*,b.* from hsbt a, DMPOS b,DMTKGL c where a.ngaybc >= " + "to_date(" + "'" + tungay + "'" + "," + "'dd/mm/yyyy" + "')" + " and a.ngaybc <= " + "to_date(" + "'" + denngay + "'" + "," + "'dd/mm/yyyy" + "') and a.MAPGD= " + "'" + str.Left(cboPos.SelectedValue.ToString().Trim(), 6) + "'" + " and a.TK= " + "'" + tk + "'" + " and a.MAPGD=b.PO_MA and a.TK=c.BANK_AC order by a.NGAYGD ";

            //MessageBox.Show(sql);
            dt = clsora.LoadDataText(sql);
            //dataGrid1.ItemsSource = dt.DefaultView;
            if (dt.Rows.Count > 0)
            {
                rpt_Pstk rpt = new rpt_Pstk();
                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
            }
            else
            {
                MessageBox.Show("Không có bản ghi nào ", "Thông báo");
            }
        }
Example #2
0
        private void BtnOKOra_OnClick(object sender, RoutedEventArgs e)
        {
            ClsOracle cls = new ClsOracle();

            cls.ClsConnect();
            int thamso = 2;

            string[] bien   = new string[thamso];
            object[] giatri = new object[thamso];
            bien[0]   = "P_MAPGD";
            giatri[0] = CboPos.SelectedValue;
            bien[1]   = "P_NGAYBC";
            //if (dtpNgay.SelectedDate != null) giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
            giatri[1] = dtpNgay.SelectedDate.Value;
            MessageBox.Show("POS : " + giatri[0] + "    ,   Ngay : " + giatri[1]);
            var dt = cls.LoadDataProcPara("uspQB_SaoKe", bien, giatri, thamso);

            dgvData.ItemsSource = dt.DefaultView;
            cls.DongKetNoi();
        }
Example #3
0
        static void Main(string[] args)
        {
            ClsMySQL    cnMySql  = new ClsMySQL();
            ClsConexion cnSql    = new ClsConexion();
            ClsOracle   cnOracle = new ClsOracle();
            int         opcion;

            Console.WriteLine("Ingrese una opcion:\n1.Conectar con SQL server\n2.Conectar con MySql\n3.Conectar con Oracle");
            opcion = int.Parse(Console.ReadLine());
            switch (opcion)
            {
            case 1:
                int selecion;
                Console.WriteLine("Ingrese opcion:\n1. Conectar a SQL Server\n2.Insertar datos\n3. Insertar doc.txt");
                selecion = int.Parse(Console.ReadLine());

                switch (selecion)
                {
                case 1:
                    cnSql.abrirConexion();
                    cnSql.cerrarConexionBD();
                    break;

                case 2:
                    string datos = cnSql.insertar_datos();
                    cnSql.EjecutaSQLDirecto(datos);

                    break;

                case 3:
                    string ob_txt = cnSql.Insert_Registro_txt();
                    cnSql.EjecutaSQLDirecto(ob_txt);
                    break;

                default:
                    Console.WriteLine("Opcion invalida");
                    break;
                }

                break;

            case 2:
                int selecion2;
                Console.WriteLine("Ingrese opcion:\n1. Conectar y comprobar conexion a MySQL\n2.Insertar datos\n3. Insertar doc.txt\n4.Hacer consulta");
                selecion2 = int.Parse(Console.ReadLine());
                switch (selecion2)
                {
                case 1:
                    cnMySql.AbrirBD();
                    cnMySql.CerrarBD();
                    break;

                case 2:
                    string dat = cnMySql.insertarBD();
                    cnMySql.CrudTable(dat);
                    break;

                case 3:
                    string dt_txt = cnMySql.Insert_Registro_txt();
                    cnMySql.CrudTable(dt_txt);
                    break;

                case 4:
                    string consult = "SELECT * FROM tb_alumnos where parcial1>6";
                    cnMySql.consulta_bd(consult);

                    break;

                default:
                    break;
                }
                break;

            case 3:
                int selecion3;
                Console.WriteLine("Ingrese opcion:\n1. Conectar a Oracle\n2.Insertar datos\n3. Insertar doc.txt");
                selecion3 = int.Parse(Console.ReadLine());
                switch (selecion3)
                {
                case 1:
                    break;

                case 2:
                    break;

                case 3:
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
        }