Ejemplo n.º 1
0
        public void Insert()
        {
            Console.WriteLine("Enter Ship ID :");
            insertobj.shipId = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter Ship Oil Amount :");
            insertobj.shipoilamount = float.Parse(Console.ReadLine());
            SqlCommand   insertCommand = new SqlCommand("insert into ship values(@Id,@oil)");
            SqlParameter idparam       = new SqlParameter("@Id", SqlDbType.Int);

            idparam.Value = insertobj.shipId;
            SqlParameter oilparam = new SqlParameter("@oil", SqlDbType.Float);

            oilparam.Value = insertobj.shipoilamount;
            insertCommand.Parameters.Add(idparam);
            insertCommand.Parameters.Add(oilparam);
            _dp.post(insertCommand);
        }