public override IDataReader GetDataReader(string commandtext)
        {
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }

            OleDbCommand cmd = new OleDbCommand(commandtext);

            cmd.Connection = (OleDbConnection)this.connection;
            if (isInTransaction)
            {
                cmd.Transaction = (OleDbTransaction)transaction;
            }
            try
            {
                System.Data.OleDb.OleDbDataReader reader = (OleDbDataReader)cmd.ExecuteReader();
                return(reader);
            }
            catch (Exception e)
            {
                throw new Exception("操作数据库失败!参考:" + e.Message);
            }
            finally
            {
                //if (connection.State != ConnectionState.Closed && isInTransaction == false) connection.Close();
                cmd.Dispose();
                cmd = null;
            }
        }
        protected void gravarVideo(object sender, EventArgs e)
        {
            try
            {
                rsGravar = objBD.ExecutaSQL("EXEC admin_piuUsuarioVideos '" + Request["VID_ID"] + "','" + Session["usuID"] + "', '" + Request["VID_TITULO"] + "','" + Request["VID_LINK"].Replace("http://youtu.be/", "").Replace("https://www.youtube.com/watch?v=", "").Replace("https://youtu.be/", "") + "','" + Request["VID_LINK"].Replace("http://youtu.be/", "http://i.ytimg.com/vi/").Replace("https://www.youtube.com/watch?v=", "http://i.ytimg.com/vi/").Replace("https://youtu.be/", "http://i.ytimg.com/vi/") + "/mqdefault.jpg', '" + Request["VID_DESCRICAO"] + "'");

                if (rsGravar == null)
                {
                    throw new Exception();
                }

                if (rsGravar.HasRows)
                {
                    rsGravar.Read();
                }

                //Libera o BD e Memória
                VerificarMedalhas();

                rsGravar.Close();
                rsGravar.Dispose();

                //Retornar para a Listagem
                Response.Redirect("meus-videos.aspx?alert=Vídeo publicado com sucesso!");
                Response.End();

            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Reads the selected file and places the contents into a DataTable.
        /// </summary>
        /// <returns>Datatable of students in file</returns>
        public DataTable ReadFile()
        {
            DataTable data = new DataTable();

            try
            {
                using (cmd = con.CreateCommand())
                {
                    cmd.CommandText = string.Format("SELECT * from [{0}]", file.Name);
                    con.Open();

                    using (dr = cmd.ExecuteReader())
                    {
                        data.Load(dr);
                    }
                }
            }
            catch (OleDbException oExe)
            {
                Debug.WriteLine(oExe.Message);
            }
            finally
            {
                con.Close();
            }

            return data;
        }
Beispiel #4
0
        // column1 column2 column3
        // ****    ***     *****
        //  **              ***
        // If inserting into column 2, we are inserting into an existing row
        // if inserting into column 1 or 3, we are creating a new row
        private bool ShouldInsertIntoNewRow(OleDb.OleDbConnection conn, string columnName)
        {
            OleDb.OleDbCommand command = new OleDb.OleDbCommand();
            command.Connection  = conn;
            command.CommandText = "SELECT TOP 1 * FROM `Sheet1$` WHERE `" + columnName + "` IS NULL";
            int ct = 0;

            try
            {
                OleDb.OleDbDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    ct++;
                }

                reader.Close();
            } catch (OleDb.OleDbException)
            {
                Forms.MessageBox.Show(Strings.error, Strings.errorCaption);
            }

            if (ct > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #5
0
        /// <summary> Creates and writes source code for all Messages and Groups.</summary>
        public static void makeAll(System.String baseDirectory, System.String version)
        {
            //get list of messages ...
            using (System.Data.OleDb.OleDbConnection conn = NormativeDatabase.Instance.Connection)
            {
                System.String sql = getMessageListQuery(version);
                System.Data.OleDb.OleDbCommand stmt = SupportClass.TransactionManager.manager.CreateStatement(conn);
                System.Data.OleDb.OleDbCommand temp_OleDbCommand;
                temp_OleDbCommand             = stmt;
                temp_OleDbCommand.CommandText = sql;
                System.Data.OleDb.OleDbDataReader rs       = temp_OleDbCommand.ExecuteReader();
                System.Collections.ArrayList      messages = new System.Collections.ArrayList();
                System.Collections.ArrayList      chapters = new System.Collections.ArrayList();
                while (rs.Read())
                {
                    messages.Add(System.Convert.ToString(rs[1 - 1]));
                    chapters.Add(System.Convert.ToString(rs[2 - 1]));
                }
                rs.Close();
                NormativeDatabase.Instance.returnConnection(conn);

                if (messages.Count == 0)
                {
                    log.Warn("No version " + version + " messages found in database " + conn.Database);
                }

                for (int i = 0; i < messages.Count; i++)
                {
                    make((System.String)messages[i], baseDirectory, (System.String)chapters[i], version);
                }
            }
        }
Beispiel #6
0
        //Get all pictures from Database and save in a list
        public List<byte[]> photos()
        {
            byte[] aBytes = null;
            List<byte[]> pictures = new List<byte[]> {};

            for (int i = 1; i <= 5000; i++)
            {
                try
                {
                    int cont = 0;
                    string query = "SELECT image FROM Data WHERE counter = " + i + " AND image <> NULL;";
                    command = new OleDbCommand(query, connection);
                    reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        aBytes = (byte[])reader.GetValue(cont);
                        pictures.Add(aBytes);
                        cont++;
                    }
                    reader.Close();
                }
                catch (Exception e)
                {
                    ////The error message is not displayed to continue with the process.
                    //MessageBox.Show("I'm so sorry, we cannot get the images.\n" + e);
                }
            }
            return pictures;
        }
        /**
         * Obtener todos los campos de una tabla
         *
         * Sino se pasa la tabla, se obtendra los campos de la tabla del modelo instanciado
         *
         * @param string tabla de la cual se obtendran sus campos
         * @return List<String> lista de campos
         */
        public List <String> getFieldsDatabase(String table = "")
        {
            table = String.IsNullOrEmpty(table) ? this.table : table;
            List <String> fieldsDatabase = new List <String>();
            string        sql            = $"SELECT * FROM {table}";

            System.Data.OleDb.OleDbDataReader oOleDbDataReader = this.oDataBase.executeSql(sql);

            try
            {
                DataTable dtSchema = new DataTable("Schema");

                dtSchema = oOleDbDataReader.GetSchemaTable();
                foreach (DataRow schemarow in dtSchema.Rows)
                {
                    fieldsDatabase.Add(schemarow.ItemArray[0].ToString());
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            return(fieldsDatabase);
        }
Beispiel #8
0
        public Form1()
        {
            InitializeComponent();

            var connection = new oleDB.OleDbConnection("Data Source=\"e:\\vic.mdb\";User ID=Admin;Provider=\"Microsoft.Jet.OLEDB.4.0\";");

            connection.Open();

            oleDB.OleDbCommand command = new oleDB.OleDbCommand("Select * From [Phones]", connection);

            oleDB.OleDbDataReader reader = command.ExecuteReader();

            DataTable table = new DataTable();

            table.Columns.Add(reader.GetName(0));
            table.Columns.Add(reader.GetName(1));
            table.Columns.Add(reader.GetName(2));

            while (reader.Read() == true)
            {
                table.Rows.Add(new object[] { reader.GetValue(0), reader.GetValue(1), reader.GetValue(2) });
            }

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

            dataGridView1.DataSource = table;
        }
 public InstrumentBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_INSTRUMENT_UUID) )
         fieldMap[_INSTRUMENT_UUID] = reader[_INSTRUMENT_UUID];
     else
         fieldMap.Add(_INSTRUMENT_UUID, reader[_INSTRUMENT_UUID]);
     if( fieldMap.ContainsKey(_INSTRUMENT_NAME) )
         fieldMap[_INSTRUMENT_NAME] = reader[_INSTRUMENT_NAME];
     else
         fieldMap.Add(_INSTRUMENT_NAME, reader[_INSTRUMENT_NAME]);
     if( fieldMap.ContainsKey(_MODEL_NAME) )
         fieldMap[_MODEL_NAME] = reader[_MODEL_NAME];
     else
         fieldMap.Add(_MODEL_NAME, reader[_MODEL_NAME]);
     if( fieldMap.ContainsKey(_ATML) )
         fieldMap[_ATML] = reader[_ATML];
     else
         fieldMap.Add(_ATML, reader[_ATML]);
     if( fieldMap.ContainsKey(_DESCRIPTION) )
         fieldMap[_DESCRIPTION] = reader[_DESCRIPTION];
     else
         fieldMap.Add(_DESCRIPTION, reader[_DESCRIPTION]);
     if( fieldMap.ContainsKey(_PART_NUMBER) )
         fieldMap[_PART_NUMBER] = reader[_PART_NUMBER];
     else
         fieldMap.Add(_PART_NUMBER, reader[_PART_NUMBER]);
     initialize();
 }
Beispiel #10
0
        public void populaLista()
        {
            rsPlay = objBD.ExecutaSQL("select PLI_ID, PLI_TITULO, PLI_URL from PlayList where PLI_ATIVO = 1 order by PLI_DH_CADASTRO desc");
            if (rsPlay == null)
            {
                throw new Exception();
            }
            if (rsPlay.HasRows)
            {
                while (rsPlay.Read())
                {
                    if (aux == 1)
                    {
                        objVideo.InnerHtml += "<iframe width=\"480\" height=\"269\" src=\""+rsPlay["PLI_URL"].ToString()+"\" frameborder=\"0\" allowfullscreen></iframe>";
                    }

                    System.Web.UI.WebControls.ListItem R = new System.Web.UI.WebControls.ListItem();
                    R.Value = rsPlay["PLI_ID"].ToString();
                    R.Text = rsPlay["PLI_TITULO"].ToString();
                    slPlayList.Items.Add(R);
                    aux++;
                }
            }
            rsPlay.Close();
            rsPlay.Dispose();
        }
        public ElectricalDataAdapter(OleDbDataReader dr, string workSheetName, int rowNumber, CommonUtils.ImportType importType)
        {
            RowNumber = rowNumber;
            WorkSheetName = workSheetName;

            Tag = dr.SafeString((int) EquipmentColumn.Tag).Trim();
            EquipmentType = dr.SafeString((int) EquipmentColumn.Type).Trim();
            Description = dr.SafeString((int) EquipmentColumn.Description).Trim();
            Notes = dr.SafeString((int) EquipmentColumn.Notes);
            AreaNumber = dr.SafeString((int)EquipmentColumn.Area).Trim();
            Specification = dr.SafeString((int)EquipmentColumn.Spec).Trim();
            PandID = dr.SafeString((int)EquipmentColumn.PID).Trim();
            MaintSysId = dr.SafeString((int)EquipmentColumn.MaintSysId);

            string classifiedString = dr.SafeString((int)EquipmentColumn.Classified);
            bool classified;
            if (bool.TryParse(classifiedString, out classified))
            {
                Classified = classified;
            }

            string isActiveString = dr.SafeString((int)EquipmentColumn.IsActive);
            bool isActive;
            if (bool.TryParse(isActiveString, out isActive))
            {
                IsActive = isActive;
            }

            Validate(importType==CommonUtils.ImportType.CreateElectrical);
        }
Beispiel #12
0
        /// <summary>
        /// Returns geometry Object IDs whose bounding box intersects 'bbox'
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns></returns>
        public List <uint> GetObjectIDsInView(SharpMap.Geometries.BoundingBox bbox)
        {
            List <uint> objectlist = new List <uint>();

            using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(_ConnectionString))
            {
                string strSQL = "Select " + this.ObjectIdColumn + " FROM " + this.Table + " WHERE ";
                if (_defintionQuery != null && _defintionQuery != "")
                {
                    strSQL += _defintionQuery + " AND ";
                }
                //Limit to the points within the boundingbox
                strSQL += this.XColumn + " BETWEEN " + bbox.Left.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + bbox.Right.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + this.YColumn +
                          " BETWEEN " + bbox.Bottom.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + bbox.Top.ToString(SharpMap.Map.numberFormat_EnUS);

                using (System.Data.OleDb.OleDbCommand command = new OleDbCommand(strSQL, conn))
                {
                    conn.Open();
                    using (System.Data.OleDb.OleDbDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr[0] != DBNull.Value)
                            {
                                objectlist.Add((uint)(int)dr[0]);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return(objectlist);
        }
Beispiel #13
0
    private void RetrieveFieldsDetail(int mpPAGESIZE)
    {
        if (Session["mlFORMRANGEDATE"] != null && Session["FormRangeDate"] != null)
        {
            List <string> mlDATE = new List <string>();

            mlDATATABLE1 = (DataTable)Session["FormRangeDate"];
            mlDATE       = (List <string>)Session["mlFORMRANGEDATE"];

            countProceeds(mlDATE[0], mlDATE[1]);
            countDelivered(mlDATE[0], mlDATE[1]);
            countReturned(mlDATE[0], mlDATE[1]);
            countDone(mlDATE[0], mlDATE[1]);

            mlDGWORKSHEET.PageSize   = mpPAGESIZE;
            mlDGWORKSHEET.DataSource = mlDATATABLE1;
            mlDGWORKSHEET.DataBind();
        }
        else
        {
            mlSql_2 = "SELECT * FROM INV_DELIVERY WHERE Disabled = '0' ORDER BY InvDate Desc";
            //mlSql_2 = "SELECT * FROM INV_DELIVERY WHERE Disabled = '0' AND CompanyCode = '" + mlCOMPANYCODE + "' ORDER BY InvDate Desc";
            mlREADER2   = mlOBJGS.DbRecordset(mlSql_2, "PB", mlCOMPANYID);
            mlDATATABLE = InsertReaderToDatatable(mlDATATABLE, mlDATAROW, mlREADER2);

            mlDGWORKSHEET.PageSize   = mpPAGESIZE;
            mlDGWORKSHEET.DataSource = mlDATATABLE;
            mlDGWORKSHEET.DataBind();
        }
    }
        private void SignUp_Click(object sender, EventArgs e)
        {
            try
            {
                sConn = " Provider=Microsoft.ACE.OLEDB.12.0 ; Data Source = finalprojectC#.accdb";
                OleDbConnection dbConn = new OleDbConnection(sConn);
                string firstname = first_NameTextBox.Text;
                string lastname = last_NameTextBox.Text;
                string adress = adressTextBox.Text;
                string city = cityTextBox.Text;
                string state = stateTextBox.Text;
                string phone = phoneTextBox.Text;
                string email = emailTextBox.Text;
                string password = passwordTextBox.Text;
                dbConn.Open();
                // creaating a query
                // sql = "INSERT INTO Customer_profil(customerid,firstname,lastname,adress,city,state,phone,email,password)" + "VALUES()";
                OleDbCommand dbCmd = new OleDbCommand("INSERT into Customer_Profil  VALUES(@customerid,@firstname,@lastname,@adress,@city,@state,@phone,@email,@password)");
                // dbCmd.CommandText = sql;
                dbCmd.Connection = dbConn;

                //Create a dbreader object
                dbReader = dbCmd.ExecuteReader();
            }
            catch (Exception exe)
            {
                label1.Text = exe.Message;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            objBD = new bd();
            objUtils = new utils();

            rsRedes = objBD.ExecutaSQL("SELECT REP_CIDADE, REP_UF FROM RedesParticipantes where REP_ATIVO = 1");
            if (rsRedes == null)
            {
                throw new Exception();
            }
            if (rsRedes.HasRows)
            {
                int contador = 1;
                while (rsRedes.Read())
                {
                    if (contador % 2 == 0)
                    {
                        listadireita.InnerHtml += "<li>" + rsRedes["REP_CIDADE"] + " - " + rsRedes["REP_UF"] + "</li>";
                    }
                    else
                    {
                        listaesquerda.InnerHtml += "<li>" + rsRedes["REP_CIDADE"] + " - " + rsRedes["REP_UF"] + "</li>";
                    }
                    contador++;
                }
            }
        }
Beispiel #16
0
        public static DataTable FunctionOfAdding(String stringsione)
        {
            var Database = new dabse.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Медведев.mdb");

            Database.Open();
            dabse.OleDbCommand    loadingOfTable = new dabse.OleDbCommand("Select * From " + stringsione, Database);
            dabse.OleDbDataReader result         = loadingOfTable.ExecuteReader();
            DataTable             table          = new DataTable();

            for (int i = 0; i < result.FieldCount; i++)
            {
                table.Columns.Add(result.GetName(i));
            }

            while (result.Read() == true)
            {
                object[] yacheiki = new object[result.FieldCount];
                for (int i = 0; i < result.FieldCount; i++)
                {
                    yacheiki[i] = result.GetValue(i);
                }
                table.Rows.Add(yacheiki);
            }
            result.Close();
            Database.Close();
            return(table);
        }
Beispiel #17
0
        private void bbatonishe_Click(object sender, EventArgs e)
        {
            dabse.OleDbCommand newCom = new dabse.OleDbCommand();
            var comand = new dabse.OleDbCommand("SELECT Код, Название FROM Дисциплины   WHERE Шифр_специальности=?", Date_baseone);

            comand.Parameters.Add("Шфр_спц", dabse.OleDbType.Integer, 255).Value = int.Parse(shifrSpecialnosti.Text);
            comand.Connection = Date_baseone;
            dabse.OleDbDataReader Result = comand.ExecuteReader();

            int    x = Result.FieldCount;
            String Name_disc, index_disk;

            while (Result.Read() == true)
            {
                index_disk = Result.GetValue(0).ToString();
                Name_disc  = Result.GetValue(1).ToString();
                dabse.OleDbCommand spisok = new dabse.OleDbCommand("insert into Дисциплины_обучение (Шифр_студента, Код_дисциплины) values (?, ?)", Date_baseone);
                spisok.Parameters.Add("Шифр_студента", dabse.OleDbType.Integer, 255).Value  = int.Parse(shifrStudenta.Text);
                spisok.Parameters.Add("Код_дисциплины", dabse.OleDbType.Integer, 255).Value = int.Parse(index_disk);
                spisok.Connection = Date_baseone;
                //MessageBox.Show(spisok.CommandText);
                spisok.ExecuteReader();
                //spisok.Close();
            }

            MessageBox.Show("Всё хорошо!!!");
        }
Beispiel #18
0
    private System.Data.DataTable createTable(System.Data.DataTable mpTBLFIELD)
    {
        mpTBLFIELD = new DataTable();
        if (mlDDLREPORTNAME.SelectedItem.Value != "InvDeliverySummary.rdlc")
        {
            mlSQLTEMP = "SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'INV_DELIVERY_STATUS_BRANCH'";
        }
        else
        {
            mlSQLTEMP = "SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'INV_DELIVERY_STATUS'";
        }
        mlRSTEMP = mlOBJGS.DbRecordset(mlSQLTEMP, "PB", mlCOMPANYID);
        if (mlRSTEMP.HasRows)
        {
            //mlDATAROW = mpTBLFIELD.NewRow();

            mlDCOL = new DataColumn("CHECK", typeof(System.Boolean));
            mlDCOL.DefaultValue = false;
            mpTBLFIELD.Columns.Add(mlDCOL);

            while (mlRSTEMP.Read())
            {
                if (mlRSTEMP["DATA_TYPE"].ToString() == "varchar" || mlRSTEMP["DATA_TYPE"].ToString() == "nvarchar" || mlRSTEMP["DATA_TYPE"].ToString() == "char" || mlRSTEMP["DATA_TYPE"].ToString() == "nchar" || mlRSTEMP["DATA_TYPE"].ToString() == "ntext")
                {
                    mlDCOL = new DataColumn(mlRSTEMP["COLUMN_NAME"].ToString(), typeof(System.String));
                    mlDCOL.DefaultValue = "";
                }
                else if (mlRSTEMP["DATA_TYPE"].ToString() == "decimal" || mlRSTEMP["DATA_TYPE"].ToString() == "numeric" || mlRSTEMP["DATA_TYPE"].ToString() == "float")
                {
                    mlDCOL = new DataColumn(mlRSTEMP["COLUMN_NAME"].ToString(), typeof(System.Decimal));
                    mlDCOL.DefaultValue = 0;
                }
                else if (mlRSTEMP["DATA_TYPE"].ToString() == "bigint" || mlRSTEMP["DATA_TYPE"].ToString() == "int" || mlRSTEMP["DATA_TYPE"].ToString() == "smallint")
                {
                    mlDCOL = new DataColumn(mlRSTEMP["COLUMN_NAME"].ToString(), typeof(System.Int64));
                    mlDCOL.DefaultValue = 0;
                }
                else if (mlRSTEMP["DATA_TYPE"].ToString() == "tinyint")
                {
                    mlDCOL = new DataColumn(mlRSTEMP["COLUMN_NAME"].ToString(), typeof(System.Boolean));
                    mlDCOL.DefaultValue = 0;
                }
                else if (mlRSTEMP["DATA_TYPE"].ToString() == "datetime" || mlRSTEMP["DATA_TYPE"].ToString() == "smalldatetime" || mlRSTEMP["DATA_TYPE"].ToString() == "timestamp")
                {
                    mlDCOL = new DataColumn(mlRSTEMP["COLUMN_NAME"].ToString(), typeof(System.DateTime));
                    mlDCOL.DefaultValue = DateTime.Now;
                }

                if (!string.IsNullOrEmpty(mlRSTEMP["DATA_TYPE"].ToString()))
                {
                    mpTBLFIELD.Columns.Add(mlDCOL);
                    //mlDATAROW[mlRSTEMP["COLUMN_NAME"].ToString()] = mlDCOL.DefaultValue;
                }
            }

            //mpTBLFIELD.Rows.Add(mlDATAROW);
        }

        return(mpTBLFIELD);
    }
Beispiel #19
0
        /// <summary>
        /// 检验是否存在数据
        /// </summary>
        /// <returns></returns>
        public bool ExistData(string SQL)
        {
            bool ret = false;

            try
            {
                System.Data.OleDb.OleDbDataReader dr = ReturnDataReader(SQL);
                if (dr.HasRows)
                {
                    ret = true;
                }
                dr.Close();
            }
            catch (Exception Ex)
            {
                throw new Exception(SQL + Ex.ToString());
            }
            finally
            {
                if (null == transaction)
                {
                    Close();
                }
            }
            return(ret);
        }
Beispiel #20
0
        public List <Person> fillComboBox()      //fill Combo
        {
            List <Person> personList = new List <Person>();

            try
            {
                command.CommandText = "SELECT * FROM Tperson";
                command.CommandType = CommandType.Text;
                connection.Open();
                System.Data.OleDb.OleDbDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Person p = new Person();
                    p.Id        = Convert.ToInt32(reader["ID"].ToString());
                    p.FirstName = reader["FirstName"].ToString();
                    p.LastName  = reader["LastName"].ToString();
                    personList.Add(p);
                }
                return(personList);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Beispiel #21
0
 private void actualizador()
 {
     Conector();
     comando.CommandText = "select * from t_articulos";
     Lector = comando.ExecuteReader();
     int registros = 0;
              while (Lector.Read() == true)
     {
         DatosCosa[registros]=new Articulo();
         //Cosa = new Articulo();
         DatosCosa[registros].CodigoArti = Convert.ToInt32(Lector["id_articulo"]);
         DatosCosa[registros].NombreArti = Lector["n_articulo"].ToString();
         DatosCosa[registros].Precio = Convert.ToDouble(Lector["precio"]);
        // DatosCosa[registros] = Cosa;
         registros++;
     }
     Lector.Close();
     comando.CommandText = "select * from t_clientes";
     Lector = comando.ExecuteReader();
     registros = 0;
        // DatosFulano = new Clientes[50];
     while (Lector.Read() == true)
     {//Fulano=new Clientes();
         DatosFulano[registros]=new Clientes();
         DatosFulano[registros].Barrio=Convert.ToInt32(Lector["id_barrio"]);
         DatosFulano[registros].Calle=Lector["calle"].ToString();
         DatosFulano[registros].CodigoClle=Convert.ToInt32(Lector["id_cliente"]);
         DatosFulano[registros].NombreClie=Lector["n_cliente"].ToString();
         DatosFulano[registros].NumeroCa=Convert.ToInt32(Lector["calle_nro"]);
         //DatosFulano[registros]=Fulano;
         registros++;
     }
     Lector.Close();
     conexion.Close();
 }
 /// <summary>
 /// Opens the connection to the database.
 /// </summary>
 static void openconnection()
 {
     dr = null;
     String ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Public\\TRManager\\IncidentDB.accdb;Persist Security Info=False;";
     connection = new OleDbConnection(ConnectionString);
     connection.Open();
 }
        public List <Object> getValues(string queryString)
        {
            List <Object> results = new List <Object>();

            configureConnection();
            using (conn)
            {
                System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(queryString, conn);
                try
                {
                    conn.Open();
                    System.Data.OleDb.OleDbDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        Object[] nextRow = new Object[reader.FieldCount];
                        reader.GetValues(nextRow);
                        results.Add(nextRow);
                    }
                    return(results);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    return(null);
                }
            }
        }
Beispiel #24
0
        public VendorDataAdapter(OleDbDataReader dr, int rowNumber)
        {
            ErrorMessages = new List<string>();

            //Name
            Name = dr.SafeString((int)VendorColumn.VendorName);
            if (String.IsNullOrEmpty(Name))
            {
                ErrorMessages.Add(string.Format("{0} returned null, please check the format of this cell in Excel (set to Text). Row number '{1}'. Skipping ", VendorColumn.VendorName, rowNumber));
            }

            //Number
            string numberString = string.Empty;
            numberString = dr.SafeString((int)VendorColumn.VendorNumber);
            int number;

            if (int.TryParse(numberString, out number))
            {
                Number = number;
            }
            else
            {
                ErrorMessages.Add(string.Format("Could not convert {0} '{1}' to number. Rown number '{2}'. Skipping ", VendorColumn.VendorNumber, numberString, rowNumber));
            }

            //City
            City = dr.SafeString((int)VendorColumn.VendorCity);
            if (String.IsNullOrEmpty(City))
            {
                ErrorMessages.Add(string.Format("{0} returned null, please check the format of this cell in Excel (set to Text). Row number '{1}'. Skipping ", VendorColumn.VendorCity, rowNumber));
            }
        }
Beispiel #25
0
 /// <summary>
 /// Returns the geometry corresponding to the Object ID
 /// </summary>
 /// <param name="oid">Object ID</param>
 /// <returns>geometry</returns>
 public IGeometry GetGeometryByID(int oid)
 {
     GeoAPI.Geometries.IGeometry geom = null;
     using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(_ConnectionString))
     {
         string strSQL = "Select " + this.XColumn + ", " + this.YColumn + " FROM " + this.Table + " WHERE " + this.ObjectIdColumn + "=" + oid.ToString();
         using (System.Data.OleDb.OleDbCommand command = new OleDbCommand(strSQL, conn))
         {
             conn.Open();
             using (System.Data.OleDb.OleDbDataReader dr = command.ExecuteReader())
             {
                 if (dr.Read())
                 {
                     //If the read row is OK, create a point geometry from the XColumn and YColumn and return it
                     if (dr[0] != DBNull.Value && dr[1] != DBNull.Value)
                     {
                         geom = SharpMap.Converters.Geometries.GeometryFactory.CreatePoint((double)dr[0], (double)dr[1]);
                     }
                 }
             }
             conn.Close();
         }
     }
     return(geom);
 }
Beispiel #26
0
        public List <string> GetSqlList(String SQLquery)
        {
            //make an Oledbcommandobject
            OleDbCommand cmd = null;

            //make an Oledbdatareader
            System.Data.OleDb.OleDbDataReader Reader = null;
            //connects to the database and catches if there is a problem connecting
            List <string> sqlViewRequests = new List <string>(); //Initializing list so things can be stored in it

            cmd = new OleDbCommand(SQLquery, Connection);
            try
            {
                Reader = cmd.ExecuteReader();
                while (Reader.Read())                                   // while there is still information to be read, pull that information out and add it to the list
                {
                    sqlViewRequests.Add(Convert.ToString((Reader[0]))); //Converting reader output to string
                }
                Reader.Close();
            }
            catch (InvalidOperationException)
            {
                Connection.Close();
            }
            Reader.Close();
            return(sqlViewRequests);
        }
 public AccesoDatos()
 {
     conexion = null;
     comando = null;
     lector = null;
     cadenaConexion = "";
 }
Beispiel #28
0
 public void loadData()
 {
     try
     {
         lvexaminee.Items.Clear();
         //OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=db.accdb");
         conn.Open();
         OleDbCommand cmd = new OleDbCommand("SELECT * FROM examineetbl", conn);
         OleDbDataReader dr;
         dr = cmd.ExecuteReader();
         if (dr.HasRows)
         {
             while (dr.Read())
             {
                 lvexaminee.Items.Add(dr[0].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[1].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[2].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[3].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[4].ToString());
                 lvexaminee.Items[lvexaminee.Items.Count - 1].SubItems.Add(dr[8].ToString());
             }
         }
         dr.Close();
         conn.Close();
     }
     catch (OleDbException ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
Beispiel #29
0
        public PipeDataAdapter(OleDbDataReader dr, string workSheetName, int rowNumber)
        {
            //setting parts via a data reader
            ErrorMessages = new List<string>();

            AreaNumber = string.Empty;
            SequenceNumber =string.Empty;
            Class = string.Empty;
            Size = string.Empty;
            FluidCode = string.Empty;
            SpecialFeature =string.Empty;
            PandID = string.Empty;
            From = string.Empty;
            To = string.Empty;
            Category = string.Empty;
            Description = string.Empty;

            mRowNumber = rowNumber;
            mWorkSheetName = workSheetName;

            AreaNumber = dr.SafeString((int)PipeColumn.Area);
            SequenceNumber = dr.SafeString((int)PipeColumn.Sequence);
            Class = dr.SafeString((int)PipeColumn.PipeClass);
            Size = dr.SafeString((int)PipeColumn.Size);
            FluidCode = dr.SafeString((int)PipeColumn.FluidCode);
            SpecialFeature = dr.SafeString((int)PipeColumn.SpecialFeature);

            PandID = dr.SafeString((int)PipeColumn.PID);
            From = dr.SafeString((int)PipeColumn.From);
            To = dr.SafeString((int)PipeColumn.To);
            Category = dr.SafeString((int)PipeColumn.Category);
            Description = dr.SafeString((int)PipeColumn.Description);
            IsActive = dr.SafeNullableBool((int) PipeColumn.IsActive);
        }
Beispiel #30
0
        public void listarBanner(int RED_ID)
        {
            try
            {
                rsBanner = objBD.ExecutaSQL("EXEC site_psBanner "+RED_ID+" ");

                if (rsBanner == null)
                {
                    throw new Exception();
                }
                if (rsBanner.HasRows)
                {
                    while (rsBanner.Read())
                    {
                       banner.InnerHtml += "<div class='banner'>";
                       banner.InnerHtml += "    <a href='" + rsBanner["BAN_LINK"] + "' title='" + rsBanner["BAN_LEGENDA"] + "'><img width='752px' height='208px' src='/upload/imagens/banners/" + rsBanner["BAN_IMAGEM"] + "' alt='" + rsBanner["BAN_LEGENDA"] + "'/></a>";
                       banner.InnerHtml += "</div>";
                    }
                }
                rsBanner.Close();
                rsBanner.Dispose();
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #31
0
        private void Disciplines_Load(object sender, EventArgs e)
        {
            //dataGridView1.DataSource = MainForm.FunctionOfAdding(nameoftable);

            var data1 = new List <Dvapolya>();

            Date_baseone = new dabse.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Медведев.mdb");
            Date_baseone.Open();
            dabse.OleDbCommand    com1      = new dabse.OleDbCommand("Select Название, Шифр FROM Специальности", Date_baseone);
            dabse.OleDbDataReader resulter1 = com1.ExecuteReader();

            while (resulter1.Read() == true)
            {
                var mc = new Dvapolya
                {
                    secondpole = resulter1[0].ToString().Trim(),
                    firstpole  = resulter1[1].ToString().Trim()
                };
                data1.Add(mc);
            }

            comboBox1.DataSource    = data1;
            comboBox1.DisplayMember = "secondpole";
            comboBox1.ValueMember   = "firstpole";
        }
Beispiel #32
0
        void LoadPicFile(Dictionary <string, ObjItem> dr)
        {
            string strSQL = "SELECT PICFILE FROM LKEQ.EQCARDEXPLAINREC WHERE CHOSCODE=" + dr["医疗机构编码"].ToString() + " AND CARDID=" + dr["卡片ID"].ToString();
            string cnnstr = ConfigurationManager.AppSettings["LKEQ_Conn"].ToString();
            //string cnnstr = "Provider = OraOLEDB.Oracle.1; Data Source = orcl; User ID = HIS; Password =linker;Persist Security Info=True";
            //string cnnstr = System.Configuration.ConfigurationManager.ConnectionStrings["LKEQ_Conn"].ToString();
            OleDbConnection con = new OleDbConnection(cnnstr);

            try
            {
                con.Open();
            }
            catch
            { }
            OleDbCommand cmd = new OleDbCommand(strSQL, con);

            System.Data.OleDb.OleDbDataReader drSM = cmd.ExecuteReader();
            while (drSM.Read())
            {
                if (drSM["PICFILE"] != DBNull.Value)                             //照片字段里有值才能进到方法体显示图片,否则清空pb
                {
                    MemoryStream ms = new MemoryStream((byte[])drSM["PICFILE"]); //把照片读到MemoryStream里
                    bytPicLoad = (byte[])drSM["PICFILE"];
                    Image imageBlob = Image.FromStream(ms, true);                //用流创建Image
                    pictureBox1.Image = imageBlob;                               //输出图片
                }
                else//照片字段里没值,清空pb
                {
                    pictureBox1.Image = null;
                }
            }
        }
Beispiel #33
0
        private void button1_Click(object sender, EventArgs e)
        {
            var Database = new OleDiBi.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Медведев.mdb");

            Database.Open();
            OleDiBi.OleDbCommand    loadingOfTable = new OleDiBi.OleDbCommand(richTextBox1.Text, Database);
            OleDiBi.OleDbDataReader result         = loadingOfTable.ExecuteReader();
            DataTable table = new DataTable();

            for (int i = 0; i < result.FieldCount; i++)
            {
                table.Columns.Add(result.GetName(i));
            }

            while (result.Read() == true)
            {
                object[] yacheiki = new object[result.FieldCount];
                for (int i = 0; i < result.FieldCount; i++)
                {
                    yacheiki[i] = result.GetValue(i);
                }
                table.Rows.Add(yacheiki);
            }
            result.Close();
            Database.Close();

            dataGridView1.DataSource = table;
        }
 //Constructor - Initializes the object with data and connects to the database.
 public MeasurementUncertainityCalculator()
 {
     string path;
     path = Path.GetDirectoryName(Application.ExecutablePath);
     try
     {
         connection = new OleDbConnection();
         connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\DB\\UC.mdb;Persist Security Info=False";
         connection.Open();
         command = new OleDbCommand();
         command.Connection = connection;
         command.CommandText = "SELECT count(Sample_Number) FROM InputTable";
         reader = command.ExecuteReader();
         while (reader.Read())
         {
             no_of_obs = (Double.Parse(reader[0].ToString()));
         }
         reader.Close();
         reader = null;
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Beispiel #35
0
        /// <summary>
        /// 返回一个DataReader
        /// </summary>
        /// <param name="commandText">SQL语句字符串</param>
        /// <param name="timeOut">超时限制</param>
        /// <returns></returns>
        public override IDataReader GetDataReader(string commandText, int timeOut)
        {
            OleDbCommand cmd = new OleDbCommand(commandText);

            cmd.Connection = (OleDbConnection)this.connection;
            if (timeOut > 30)
            {
                cmd.CommandTimeout = timeOut;
            }
            if (isInTransaction)
            {
                cmd.Transaction = (OleDbTransaction)transaction;
            }
            try
            {
                System.Data.OleDb.OleDbDataReader reader = (OleDbDataReader)cmd.ExecuteReader();
                return(reader);
            }
            catch (Exception err)
            {
                throw new EntityException(err.Message);
            }
            finally
            {
                cmd.Dispose();
                cmd = null;
            }
        }
        private void BookCatalog_Load(object sender, EventArgs e)
        {
            try{
              // creating a connection
            sConn = " Provider=Microsoft.ACE.OLEDB.12.0 ; Data Source = finalprojectC#.accdb";
            OleDbConnection dbConn = new OleDbConnection(sConn);
            dbConn.Open();
            // creating a sql query
             sql = "SELECT * FROM Books_online ORDER BY  BookName ASC, Book_Price ASC;";
             OleDbCommand  dbCmd = new OleDbCommand();
             dbCmd.CommandText = sql;
             dbCmd.Connection = dbConn;

               //Create a dbreader object
             dbReader = dbCmd.ExecuteReader();
            while (dbReader.Read())
                {
               // adding book name and price to listbox

                    fprice = Convert.ToDouble(dbReader["Book_Price"]);
                    this.listBox1.Items.Add(dbReader["BookName"].ToString() + "  " + "$" + dbReader["Book_Price"]);

               }

            dbReader.Close();
            dbConn.Close();
            }
             catch (System.Exception exc)
             {
              label1.Text = exc.Message;
             }
        }
        public void ListarConfig(string ID)
        {
            if (string.IsNullOrWhiteSpace(ID) == false)
            {
                rsConfig = objBD.ExecutaSQL("EXEC site_psListarConfig " + ID);
                if (rsConfig == null)
                {
                    throw new Exception();
                }
                if (rsConfig.HasRows)
                {
                    rsConfig.Read();
                    USU_ID.Attributes.Add("value", rsConfig["USU_ID"].ToString());
                    USU_NOME.Attributes.Add("value", rsConfig["USU_NOME"].ToString());
                    USU_EMAIL.Attributes.Add("value", rsConfig["USU_EMAIL"].ToString());

                    ListItem li = CAR_ID.Items.FindByValue(rsConfig["CAR_ID"].ToString());
                    li.Selected = true;

                    //pivacidade
                    if (rsConfig["PRI_PERFIL"].ToString() == "True") { sim_perfil.Checked = true; } else { nao_perfil.Checked = true; }
                    if (rsConfig["PRI_BLOG"].ToString() == "True") { sim_blog.Checked = true; } else { nao_blog.Checked = true; }
                    if (rsConfig["PRI_FOTOS"].ToString() == "True") { sim_midia.Checked = true; } else { nao_midia.Checked = true; }
                    if (rsConfig["PRI_FOTOS"].ToString() == "True") { sim_video.Checked = true; } else { nao_video.Checked = true; }
                    //notificaoes
                    if (rsConfig["NOT_BLOG"].ToString() == "True") { sim_blog2.Checked = true; } else { nao_blog2.Checked = true; }
                    if (rsConfig["NOT_GALERIA"].ToString() == "True") { sim_galeria.Checked = true; } else { nao_galeria.Checked = true; }
                    if (rsConfig["NOT_FORUM"].ToString() == "True") { sim_forum.Checked = true; } else { nao_forum.Checked = true; }
                    if (rsConfig["NOT_DOCUMENTADAS"].ToString() == "True") { sim_criacao.Checked = true; } else { nao_criacao.Checked = true; }

                    InsereCategoria(infantil);
                    InsereCategoria(fundamental);
                }
            }
        }
 public SignalAttributeMasterBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_SIGNAL_ATTRIBUTE_ID) )
         fieldMap[_SIGNAL_ATTRIBUTE_ID] = reader[_SIGNAL_ATTRIBUTE_ID];
     else
         fieldMap.Add(_SIGNAL_ATTRIBUTE_ID, reader[_SIGNAL_ATTRIBUTE_ID]);
     if( fieldMap.ContainsKey(_SIGNAL_ID) )
         fieldMap[_SIGNAL_ID] = reader[_SIGNAL_ID];
     else
         fieldMap.Add(_SIGNAL_ID, reader[_SIGNAL_ID]);
     if( fieldMap.ContainsKey(_ATTRIBUTE_NAME) )
         fieldMap[_ATTRIBUTE_NAME] = reader[_ATTRIBUTE_NAME];
     else
         fieldMap.Add(_ATTRIBUTE_NAME, reader[_ATTRIBUTE_NAME]);
     if( fieldMap.ContainsKey(_DEFAULT_VALUE) )
         fieldMap[_DEFAULT_VALUE] = reader[_DEFAULT_VALUE];
     else
         fieldMap.Add(_DEFAULT_VALUE, reader[_DEFAULT_VALUE]);
     if( fieldMap.ContainsKey(_TYPE) )
         fieldMap[_TYPE] = reader[_TYPE];
     else
         fieldMap.Add(_TYPE, reader[_TYPE]);
     if( fieldMap.ContainsKey(_FIXED_VALUE) )
         fieldMap[_FIXED_VALUE] = reader[_FIXED_VALUE];
     else
         fieldMap.Add(_FIXED_VALUE, reader[_FIXED_VALUE]);
     initialize();
 }
Beispiel #39
0
        public static string LoadById(int id)
        {
            string sql = "SELECT * FROM CUSTOMER WHERE CUSTID = " + id.ToString() + "";
            string name = "";
            try
            {
                cn = new OleDbConnection(path);
                cn.Open();
                cmd.Connection = cn;
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.TableDirect;
                dr = cmd.ExecuteReader();
                dr.Read();
                name = dr[1].ToString();
            }
            catch (Exception e)
            {

            }
            finally
            {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                cmd.Dispose();
                cn.Close();

            }

            return name;
        }
Beispiel #40
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        conn = new OleDbConnection("Provider=MSDAORA;Data Source=orcl;Persist Security Info=True;Password=db_mail;User ID=db_mail");
        string u_name, password;
        u_name = TextBox1.Text;
        password = TextBox2.Text;
        rec_mail rr = new rec_mail();
        string comp=rr.un_enc(u_name, password);
        //u_name = raw_u_name + password[2];
        //Response.Write(u_name);
        conn.Open();
        cmd=new OleDbCommand ("select enc_fun(user_id,password) from username where user_id='"+ u_name +"'",conn);
        dr = cmd.ExecuteReader();
        //dr.Read();
        //Response.Write(raw_u_name + dr["password"].ToString()[2]);
        if (dr.HasRows == false)
            Label2.Visible = true;
        else
        {
            dr.Read();

            if (dr[0].ToString() == comp)
            {
                Session["us_name"] = u_name;
                Response.Redirect("Mail_box.aspx");
            }
            else
                Label2.Visible = true;
        }
        dr.Close();
        conn.Close();
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            objUtils = new utils();
            objBD = new bd();

            switch (Request["acao"])
            {
                case ("editar"):
                    rsLista = objBD.ExecutaSQL("select EQU_ID, EQU_NOME, EQU_DESCRICAO from  Equipe where EQU_ID ='" + Request["EQU_ID"] + "'");
                    if (rsLista == null)
                    {
                        throw new Exception();
                    }
                    if (rsLista.HasRows)
                    {
                        rsLista.Read();
                        Response.Write(rsLista["EQU_ID"] + "|" + rsLista["EQU_NOME"] + "|" + rsLista["EQU_DESCRICAO"]);
                    }
                    break;

                default:
                    PopulaLista();

                    break;
            }
        }
 public TestSignalLibraryBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_ID) )
         fieldMap[_ID] = reader[_ID];
     else
         fieldMap.Add(_ID, reader[_ID]);
     if( fieldMap.ContainsKey(_LIBRARY_NAME) )
         fieldMap[_LIBRARY_NAME] = reader[_LIBRARY_NAME];
     else
         fieldMap.Add(_LIBRARY_NAME, reader[_LIBRARY_NAME]);
     if( fieldMap.ContainsKey(_CONTENT) )
         fieldMap[_CONTENT] = reader[_CONTENT];
     else
         fieldMap.Add(_CONTENT, reader[_CONTENT]);
     if( fieldMap.ContainsKey(_FILE_NAME) )
         fieldMap[_FILE_NAME] = reader[_FILE_NAME];
     else
         fieldMap.Add(_FILE_NAME, reader[_FILE_NAME]);
     if( fieldMap.ContainsKey(_LAST_UPDATE) )
         fieldMap[_LAST_UPDATE] = reader[_LAST_UPDATE];
     else
         fieldMap.Add(_LAST_UPDATE, reader[_LAST_UPDATE]);
     if( fieldMap.ContainsKey(_TARGET_NAMESPACE) )
         fieldMap[_TARGET_NAMESPACE] = reader[_TARGET_NAMESPACE];
     else
         fieldMap.Add(_TARGET_NAMESPACE, reader[_TARGET_NAMESPACE]);
     initialize();
 }
Beispiel #43
0
        /// <summary>
        /// Boundingbox of dataset
        /// </summary>
        /// <returns>boundingbox</returns>
        public GeoAPI.Geometries.IEnvelope GetExtents()
        {
            GeoAPI.Geometries.IEnvelope box = null;
            using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(_ConnectionString))
            {
                string strSQL = "Select Min(" + this.XColumn + ") as MinX, Min(" + this.YColumn + ") As MinY, " +
                                "Max(" + this.XColumn + ") As MaxX, Max(" + this.YColumn + ") As MaxY FROM " + this.Table;
                if (!String.IsNullOrEmpty(_defintionQuery))                 //If a definition query has been specified, add this as a filter on the query
                {
                    strSQL += " WHERE " + _defintionQuery;
                }

                using (System.Data.OleDb.OleDbCommand command = new OleDbCommand(strSQL, conn))
                {
                    conn.Open();
                    using (System.Data.OleDb.OleDbDataReader dr = command.ExecuteReader())
                    {
                        if (dr.Read())
                        {
                            //If the read row is OK, create a point geometry from the XColumn and YColumn and return it
                            if (dr[0] != DBNull.Value && dr[1] != DBNull.Value && dr[2] != DBNull.Value && dr[3] != DBNull.Value)
                            {
                                box = SharpMap.Converters.Geometries.GeometryFactory.CreateEnvelope((double)dr[0], (double)dr[1], (double)dr[2], (double)dr[3]);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return(box);
        }
Beispiel #44
0
    public void AlterarDados(tbVendaDTO venda)
    {
        String sSQL = "";

        sSQL += "UPDATE tbVenda SET idProduto = @idProduto, idVendedor = @idVendedor, qtQuantidade = @qtQuantidade WHERE idVenda = @idVenda ";

        conexao = (OleDbConnection)CriaConexaoOleDb();
        command = new OleDbCommand(sSQL, conexao);
        command.CommandType = CommandType.Text;

        OleDbParameter parametro = command.Parameters.Add("@idProduto", OleDbType.Integer);
        parametro.Value = venda.Produto.idProduto;

        parametro = command.Parameters.Add("@idVendedor", OleDbType.Integer);
        parametro.Value = venda.Vendedor.idVendedor;

        parametro = command.Parameters.Add("@qtQuantidade", OleDbType.Integer);
        parametro.Value = venda.qtQuantidade;

        parametro = command.Parameters.Add("@idVenda", OleDbType.Integer);
        parametro.Value = venda.idVenda;

        try
        {
            drOleDb = command.ExecuteReader();
            drOleDb.Close();
            conexao.Close();
        }
        catch (SystemException e)
        {
            erro = e.Message;
        }
    }
Beispiel #45
0
        /// <summary>
        /// Returns geometries within the specified bounding box
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns></returns>
        public List <SharpMap.Geometries.Geometry> GetGeometriesInView(SharpMap.Geometries.BoundingBox bbox)
        {
            List <Geometries.Geometry> features = new List <SharpMap.Geometries.Geometry>();

            using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(_ConnectionString))
            {
                string strSQL = "Select " + this.XColumn + ", " + this.YColumn + " FROM " + this.Table + " WHERE ";
                if (_defintionQuery != null && _defintionQuery != "")
                {
                    strSQL += _defintionQuery + " AND ";
                }
                //Limit to the points within the boundingbox
                strSQL += this.XColumn + " BETWEEN " + bbox.Left.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + bbox.Right.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " +
                          this.YColumn + " BETWEEN " + bbox.Bottom.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + bbox.Top.ToString(SharpMap.Map.numberFormat_EnUS);

                using (System.Data.OleDb.OleDbCommand command = new OleDbCommand(strSQL, conn))
                {
                    conn.Open();
                    using (System.Data.OleDb.OleDbDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr[0] != DBNull.Value && dr[1] != DBNull.Value)
                            {
                                features.Add(new SharpMap.Geometries.Point((double)dr[0], (double)dr[1]));
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return(features);
        }
 public SignalMasterBean( OleDbDataReader reader )
     : base(_TABLE_NAME)
 {
     if( fieldMap.ContainsKey(_SIGNAL_ID) )
         fieldMap[_SIGNAL_ID] = reader[_SIGNAL_ID];
     else
         fieldMap.Add(_SIGNAL_ID, reader[_SIGNAL_ID]);
     if( fieldMap.ContainsKey(_SIGNAL_NAME) )
         fieldMap[_SIGNAL_NAME] = reader[_SIGNAL_NAME];
     else
         fieldMap.Add(_SIGNAL_NAME, reader[_SIGNAL_NAME]);
     if( fieldMap.ContainsKey(_PARENT_SIGNAL_ID) )
         fieldMap[_PARENT_SIGNAL_ID] = reader[_PARENT_SIGNAL_ID];
     else
         fieldMap.Add(_PARENT_SIGNAL_ID, reader[_PARENT_SIGNAL_ID]);
     if( fieldMap.ContainsKey(_XMLNS) )
         fieldMap[_XMLNS] = reader[_XMLNS];
     else
         fieldMap.Add(_XMLNS, reader[_XMLNS]);
     if( fieldMap.ContainsKey(_UUID) )
         fieldMap[_UUID] = reader[_UUID];
     else
         fieldMap.Add(_UUID, reader[_UUID]);
     initialize();
 }
Beispiel #47
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            string strGroupName, strGroupContent;

            DateTime dtmCreateDate;

            if (txtGroupName.Text == "")
            {
                this.RegisterStartupScript("newWindow", "<script language='javascript'>alert('请填写群组名称!')</script>");
                return;
            }

            strGroupName = txtGroupName.Text;
            strGroupContent = txtGroupName.Text;

            string strsql;
            myGroup = AccessDateHelper.ExecuteReader("select * from [Group] where UserID=" + Convert.ToInt16(myUserID) + "");
            if (myGroup.Read())
            {
                strsql = "update [Group] set GroupName='" + strGroupName + "',GroupContent='" + strGroupContent + "' where GroupID=" + Convert.ToInt16(myGroup["GroupID"]) + "";
            }
            else
            {
                strsql = "insert into [Group] (GroupName,GroupContent,UserID) values ('" + strGroupName + "','" + strGroupContent + "',"+Convert.ToInt16(myUserID)+")";
            }

            if (AccessDateHelper.ExecuteNonQuery(strsql) > 0)
            {
                this.RegisterStartupScript("newWindow", "<script language='javascript'>alert('群组更改成功!');try{ window.opener.RefreshForm() }catch(e){};</script>");
            }
            else
            {
                this.RegisterStartupScript("newWindow", "<script language='javascript'>alert('新建试题失败!')</script>");
            }
        }
Beispiel #48
0
        /// <summary>
        /// Returns geometries within the specified bounding box
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns></returns>
        public ICollection <IGeometry> GetGeometriesInView(IEnvelope bbox, double minGeometrySize)
        {
            Collection <GeoAPI.Geometries.IGeometry> features = new Collection <GeoAPI.Geometries.IGeometry>();

            using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(_ConnectionString))
            {
                string strSQL = "Select " + this.XColumn + ", " + this.YColumn + " FROM " + this.Table + " WHERE ";
                if (!String.IsNullOrEmpty(_defintionQuery))
                {
                    strSQL += _defintionQuery + " AND ";
                }
                //Limit to the points within the boundingbox
                strSQL += this.XColumn + " BETWEEN " + bbox.MinX.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + bbox.MaxX.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " +
                          this.YColumn + " BETWEEN " + bbox.MaxY.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + bbox.MinY.ToString(SharpMap.Map.numberFormat_EnUS);

                using (System.Data.OleDb.OleDbCommand command = new OleDbCommand(strSQL, conn))
                {
                    conn.Open();
                    using (System.Data.OleDb.OleDbDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr[0] != DBNull.Value && dr[1] != DBNull.Value)
                            {
                                features.Add(SharpMap.Converters.Geometries.GeometryFactory.CreatePoint((double)dr[0], (double)dr[1]));
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return(features);
        }
Beispiel #49
0
        public void Ultimas()
        {
            rsLista = objBD.ExecutaSQL("select top 3  F.FTO_ID, U.USU_NOME, U.USU_USUARIO, FME_MENSAGEM, CONVERT(VARCHAR(10),FME_DH_PUBLICACAO, 103) AS FME_DH_PUBLICACAO, T.FTO_TITULO from ForumMensagem F inner join ForumTopicos T on (T.FTO_ID = F.FTO_ID) inner join Usuario U ON (U.USU_ID = F.USU_ID) where RED_ID = " + Session["redeID"] + " and F.FME_ATIVO = 1 order by F.FME_DH_PUBLICACAO desc");

            if (rsLista == null)
            {
                throw new Exception();
            }
            if (rsLista.HasRows)
            {
                while (rsLista.Read())
                {
                    ultimasMensagens.InnerHtml += " <div class=\"txt blog_txt txt_forum\">";
                    ultimasMensagens.InnerHtml += "   <div class=\"txt\">";
                    ultimasMensagens.InnerHtml += "       <a href=\"/forum-lista/" + objUtils.GerarURLAmigavel(rsLista["FTO_TITULO"].ToString()) + "/1\" title=\"" + rsLista["FTO_TITULO"] + "\"><p>" + objUtils.CortarString(true, 100, rsLista["FME_MENSAGEM"].ToString()) + "</p></a>";
                    ultimasMensagens.InnerHtml += "       <p class=\"destque_forum\">Mensagem enviada por: <a href='/perfil/" + rsLista["USU_USUARIO"].ToString() + "' title='" + rsLista["USU_NOME"].ToString() + "'>" + rsLista["USU_NOME"].ToString() + "</a></p>";
                    ultimasMensagens.InnerHtml += "       <p class=\"destque_forum\">Enviada em: <b>" + rsLista["FME_DH_PUBLICACAO"].ToString() + "</b></p>";
                    ultimasMensagens.InnerHtml += "       <p class=\"destque_forum\">Tópico: <b><a href=\"/forum-lista/" + objUtils.GerarURLAmigavel(rsLista["FTO_TITULO"].ToString()) + "/1\" title=\"" + rsLista["FTO_TITULO"] + "\">" + rsLista["FTO_TITULO"].ToString() + "</a></b></p><br /><br />";
                    ultimasMensagens.InnerHtml += "   </div>";
                    ultimasMensagens.InnerHtml += " </div>";
                }
            }
            rsLista.Close();
            rsLista.Dispose();
        }
Beispiel #50
0
        /// <summary>
        /// Returns geometry Object IDs whose bounding box intersects 'envelope'
        /// </summary>
        /// <param name="envelope"></param>
        /// <returns></returns>
        public ICollection <int> GetObjectIDsInView(IEnvelope envelope)
        {
            Collection <int> objectlist = new Collection <int>();

            using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(_ConnectionString))
            {
                string strSQL = "Select " + this.ObjectIdColumn + " FROM " + this.Table + " WHERE ";
                if (!String.IsNullOrEmpty(_defintionQuery))
                {
                    strSQL += _defintionQuery + " AND ";
                }
                //Limit to the points within the boundingbox
                strSQL += this.XColumn + " BETWEEN " + envelope.MinX.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + envelope.MaxX.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + this.YColumn +
                          " BETWEEN " + envelope.MaxY.ToString(SharpMap.Map.numberFormat_EnUS) + " AND " + envelope.MinY.ToString(SharpMap.Map.numberFormat_EnUS);

                using (System.Data.OleDb.OleDbCommand command = new OleDbCommand(strSQL, conn))
                {
                    conn.Open();
                    using (System.Data.OleDb.OleDbDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr[0] != DBNull.Value)
                            {
                                objectlist.Add((int)dr[0]);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return(objectlist);
        }
Beispiel #51
0
        public void Initialise()
        {
            string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=phonebook.accdb";
            OleDbConnection conn = new OleDbConnection(connectionString);

            string sql = "SELECT * FROM task ORDER BY id";

            OleDbCommand cmd = new OleDbCommand(sql, conn);

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader();
                reader.Read();

                lblTask.Text = reader.GetString(1).ToString();
                txtTask.Text = reader.GetString(2).ToString();

                reader.Close();
                conn.Close();
            }
            catch
            {
                //MessageBox.Show(e.Message);
            }
        }
Beispiel #52
0
 /// <summary>取得OleDbDataReader</summary>
 /// <param name="strSQL">SQL 指令</param>
 /// <param name="oleDbConn">連線物件(OleDbConnection)</param>
 /// <returns>OleDbDataReader</returns>
 /// <remarks></remarks>
 public static OleDbDataReader getOleDbDataReader(string strSQL, System.Data.OleDb.OleDbConnection oleDbConn)
 {
     System.Data.OleDb.OleDbDataReader dr  = null;
     System.Data.OleDb.OleDbCommand    cmd = null;
     try
     {
         if (oleDbConn == null)
         {
             oleDbConn = createOleDbConnection();
         }
         if (!(oleDbConn.State == ConnectionState.Open))
         {
             oleDbConn.Open();
         }
         cmd = new System.Data.OleDb.OleDbCommand(strSQL, oleDbConn);
         dr  = cmd.ExecuteReader(CommandBehavior.CloseConnection);
     }
     catch (Exception Ex)
     {
         //Message.alertMessage("C0001", null, Ex.Message.ToString(), null);
         if (!(oleDbConn.State == ConnectionState.Closed))
         {
             oleDbConn.Close();
         }
         dr = null;
     }
     return(dr);
 }
Beispiel #53
0
        public void FillCombo()
        {
            try
            {

                con = new OleDbConnection(cs);
                con.Open();
                string ct = "select RTRIM(CategoryName) from Category order by CategoryName";
                cmd = new OleDbCommand(ct);
                cmd.Connection = con;
                rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    cmbCategory.Items.Add(rdr[0]);
                }
                con.Close();
                con = new OleDbConnection(cs);
                con.Open();
                string ct1 = "select RTRIM(CompanyName) from Company order by CompanyName";
                cmd = new OleDbCommand(ct1);
                cmd.Connection = con;
                rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    cmbCompany.Items.Add(rdr[0]);
                }
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public InterlockDataAdapter(OleDbDataReader dr ,IList<string> dynamicList, int startColumn)
        {
            ControlSystemName = string.Empty;
            InterlockTypeName =
            Number = string.Empty;
            Cause = string.Empty;
            Description = string.Empty;

            ControlSystemName = dr.SafeString((int)InterlockColumn.ControlSystemName).Trim();
            InterlockTypeName = dr.SafeString((int)InterlockColumn.InterlockType).Trim();
            Number = dr.SafeString((int)InterlockColumn.Number).Trim();
            Cause = dr.SafeString((int)InterlockColumn.Cause).Trim();
            Description = dr.SafeString((int)InterlockColumn.Description).Trim();

            DynamicProperties = new List<DynamicProperty>();

            if (dynamicList != null && dynamicList.Any())
            {
                for (int d = 0; d < dynamicList.Count(); d++)
                {
                    string p = dynamicList[d];

                    DynamicProperty property = new DynamicProperty();

                    property.PropertyName = p;
                    property.PropertyValue = dr.SafeString(startColumn + d);

                    DynamicProperties.Add(property);
                }
            }
        }
Beispiel #55
0
 public void RetrieveFieldsDetail()
 {
     try
     {
         mlSQLM = " SELECT '01' AS ColInd, 'Admin' AS Description,'' AS ExecFile,'' AS SpecialParameter UNION ALL " +
                  " SELECT '02' AS ColInd, Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'AD%' " +
                  "" +
                  " UNION ALL SELECT '03' AS ColInd,'^','','' " +
                  " UNION ALL  SELECT '04'AS ColInd,'Master Data','','' UNION ALL " +
                  " SELECT '05',Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'MS%' " +
                  "" +
                  " UNION ALL SELECT '06' AS ColInd,'^','','' " +
                  " UNION ALL  SELECT '07' AS ColInd,'Transaction','','' UNION ALL " +
                  " SELECT '08', Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'TR%' " +
                  "" +
                  " UNION ALL SELECT '09' AS ColInd,'^','','' " +
                  " UNION ALL  SELECT '10' AS ColInd,'Posting','','' UNION ALL " +
                  " SELECT '11',Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'PS%' " +
                  "" +
                  " UNION ALL SELECT '12' AS ColInd,'^','','' " +
                  " UNION ALL  SELECT '13' AS ColInd,'Report','','' UNION ALL " +
                  " SELECT '14',Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'RP%' " +
                  "" +
                  " UNION ALL SELECT '15' AS ColInd,'^','','' " +
                  " UNION ALL  SELECT '16' AS ColInd,'Utility','','' UNION ALL " +
                  " SELECT '17',Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'UT%' " +
                  "" +
                  " UNION ALL SELECT '18' AS ColInd,'^','','' " +
                  " UNION ALL  SELECT '19' AS ColInd,'Monitoring Delivery','','' UNION ALL " +
                  " SELECT '20',Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'MD%' " +
                  "" +
                  " UNION ALL SELECT '21' AS ColInd,'^','','' " +
                  " UNION ALL  SELECT '22' AS ColInd,'','','' UNION ALL " +
                  " SELECT '23',Description, ExecFile, SpecialParameter FROM AD_MENU WHERE " +
                  " MenuID IN (SELECT MenuID FROM AD_GROUPMENU WHERE GroupMenu = '" + mlGROUPMENU + "')" +
                  " AND ExecFile <> '' AND (SysID='IA') AND MenuTransType LIKE 'BN%' " +
                  "" +
                  " ORDER BY ColInd,Description" +
                  "";
         mlREADERM = mlOBJGS.DbRecordset(mlSQLM, "AD", "AD");
     }
     catch
     {
     }
 }
Beispiel #56
0
        private void button3_Click(object sender, EventArgs e)
        {
            String surname;
            String groupName;
            String specialityName;
            String formOfEducation;
            String yearsofEducation;

            List <String> surnameMas          = new List <String>();
            List <String> groupNameMas        = new List <String>();
            List <String> specialityNameMas   = new List <String>();
            List <String> formOfEducationMas  = new List <String>();
            List <String> yearsofEducationMas = new List <String>();

            var Command = new dabse.OleDbCommand("SELECT Студенты.Фамилия, Группы.Название, Специальности.Название, Студенты.Форма_обучения, Специальности.Срок_обучения FROM  Группы, Группы_обучение, Студенты, Специальности WHERE Группы.Номер = Группы_обучение.Номер_группы AND Группы_обучение.Шифр_студента = Студенты.Шифр AND Студенты.Специальность = Специальности.Шифр AND Студенты.Шифр = " + thirdshifrsudenta.Text + "AND Группы_обучение.Год = " + thirdnameofsubject.Text, Date_baseone);

            dabse.OleDbDataReader Ask3 = Command.ExecuteReader();

            while (Ask3.Read() == true)
            {
                surname          = Ask3[0].ToString();
                groupName        = Ask3[1].ToString();
                specialityName   = Ask3[2].ToString();
                formOfEducation  = Ask3[3].ToString();
                yearsofEducation = Ask3[4].ToString();

                surnameMas.Add(surname);
                groupNameMas.Add(groupName);
                specialityNameMas.Add(specialityName);
                formOfEducationMas.Add(formOfEducation);
                yearsofEducationMas.Add(yearsofEducation);
            }

            wooord.Application wordApp = new wooord.Application();
            wordApp.Visible = true;
            object oMissing = Type.Missing;

            wooord.Document  wordDoc;
            wooord.Paragraph wordPar;
            wooord.Range     wordRan;
            wordDoc = wordApp.Documents.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing);

            //задаём форматирование для первого абзаца, которое будет так же и для всего документа, но
            //это не страшно. Последующие абзацы будут иметь другое форматирование

            Object begin = Type.Missing;
            Object end   = Type.Missing;

            wordRan = wordDoc.Range(ref begin, ref end);
            wordRan.ParagraphFormat.Alignment = wooord.WdParagraphAlignment.wdAlignParagraphCenter;
            wordRan.Text = "Справка";

            //теперь задаём форматирование следующего абзаца

            wordPar = wordDoc.Paragraphs.Add(ref oMissing);
            wordDoc.Paragraphs[2].Range.ParagraphFormat.Alignment = wooord.WdParagraphAlignment.wdAlignParagraphLeft;
            wordDoc.Paragraphs[2].Range.Font.Size = 10;
            wordDoc.Paragraphs[2].Range.Text      = "Студент " + surnameMas[0] + " обучается в группе " + groupNameMas[0] + " по специальности " + specialityNameMas[0] + ". Форма обучения – " + formOfEducationMas[0] + ". Срок обучения – " + yearsofEducationMas[0] + ".";
        }
        public void Select_TabelaControleDeVendaDepartamento()
        {
            String _strSQL;

            _strSQL = "SELECT * FROM TabelaControleDeVendaDepartamento;";
            _OleDbCommand.CommandText = _strSQL;
            _DataReader = _OleDbCommand.ExecuteReader();
        }
        public void Select_TabelaControleDeVendaProdutosEAN13(String _EAN13)
        {
            String _strSQL;

            _strSQL = "SELECT * FROM TabelaControleDeVendaProdutoServico WHERE EAN13 = '" + _EAN13 + "'";
            _OleDbCommand.CommandText = _strSQL;
            _DataReader = _OleDbCommand.ExecuteReader();
        }
        public void Select_TabelaControleDeVendaProdutos()
        {
            String _strSQL;

            _strSQL = "SELECT EAN13, NOME_PRODUTO_SERVICO FROM TabelaControleDeVendaProdutoServico Order by Nome_Produto_Servico;";
            _OleDbCommand.CommandText = _strSQL;
            _DataReader = _OleDbCommand.ExecuteReader();
        }
        public void Select_TabelaControleDeVendaOperacao()
        {
            String _strSQL;

            _strSQL = "SELECT TIPO_OPERACAO, DESCRICAO FROM TabelaControleDeVendaTipo_Operacao Order by TIPO_OPERACAO;";
            _OleDbCommand.CommandText = _strSQL;
            _DataReader = _OleDbCommand.ExecuteReader();
        }