コード例 #1
0
ファイル: MySQL.cs プロジェクト: peterlvilim/ShippingManager
        public List<LineItem> GetLineItems(Invoice invoice)
        {
            List<LineItem> lineitems = new List<LineItem>();

            try
            {

                MySqlConnection theconnection = Connect();
                List<DriverInfo> drivers = new List<DriverInfo>();
                MySqlDataReader rdr = Select("SELECT * FROM invoice_line_data WHERE inl_inv_number='" + invoice.number+ "';", theconnection);
                while (rdr.Read())
                {
                    LineItem toinsert = new LineItem((int)rdr[0],(int)rdr[1],(string)rdr[2],(int)rdr[3]);
                    lineitems.Add(toinsert);
                }
                Disconnect();
                return (lineitems);
            }
            catch {
                Disconnect();
                return (null); }
        }
コード例 #2
0
        public void ReadLineItems()
        {
            OleDbConnection dbConn = new OleDbConnection(@"Provider=vfpoledb.1;Data Source="+linefile+";Collating Sequence=general");
            try
            {
                dbConn.Open();

                // Open connection.
                OleDbCommand command = new OleDbCommand("select INVNO,DESCRIPT,COST from oelines.dbf", dbConn);
                LineItem lineitemtoadd;
                OleDbDataReader reader= command.ExecuteReader();
                while (reader.Read())
                {
                    lineitemtoadd = new LineItem(Int32.Parse((string)reader[0]), 0, (string)reader[1].ToString().Trim(), System.Decimal.Multiply((System.Decimal)reader[2],100));
                    rawlineitems.Add(lineitemtoadd);
                }
                dbConn.Close();
            }
            catch
            {
            }
        }