コード例 #1
0
ファイル: DBContext.cs プロジェクト: GDLMadushanka/Test
        public List <BiddersOfNotice> FindBiddersOfTender(string tenderId)
        {
            DbConnection.Open();
            MySqlCommand command = DbConnection.CreateCommand();

            command.CommandText = "select * from bid left join bidder on bid.owner = bidder.username where noticeid =@value";
            command.Parameters.AddWithValue("@value", tenderId);
            MySqlDataReader        reader    = command.ExecuteReader();
            List <BiddersOfNotice> biderList = new List <BiddersOfNotice>();

            while (reader.Read())
            {
                BiddersOfNotice bidder = new BiddersOfNotice();
                bidder.userName = reader.GetString("userName");
                bidder.BidId    = reader.GetInt32("BidId");
                bidder.Name     = reader.GetString("name");
                bidder.Address  = reader.GetString("address");
                bidder.tpNo     = reader.GetString("tpNo");
                biderList.Add(bidder);
            }
            DbConnection.Close();
            return(biderList);
        }
コード例 #2
0
ファイル: DBContext.cs プロジェクト: GDLMadushanka/Test
 public List<BiddersOfNotice> FindBiddersOfTender(string tenderId)
 {
     DbConnection.Open();
     MySqlCommand command = DbConnection.CreateCommand();
     command.CommandText = "select * from bid left join bidder on bid.owner = bidder.username where noticeid =@value";
     command.Parameters.AddWithValue("@value", tenderId);
     MySqlDataReader reader = command.ExecuteReader();
     List<BiddersOfNotice> biderList = new List<BiddersOfNotice>();
     while (reader.Read())
     {
         BiddersOfNotice bidder = new BiddersOfNotice();
         bidder.userName = reader.GetString("userName");
         bidder.BidId = reader.GetInt32("BidId");
         bidder.Name = reader.GetString("name");
         bidder.Address = reader.GetString("address");
         bidder.tpNo = reader.GetString("tpNo");
         biderList.Add(bidder);
     }
     DbConnection.Close();
     return biderList;
 }