Ejemplo n.º 1
0
        public void AddAuto(string AutoName)
        {
            SqlCommand myCommand;

            string SQLInsertNewAuto = "INSERT INTO Auto ([AutoName]) VALUES ('{0}')";

            string insertbill = string.Format(SQLInsertNewAuto, AutoName);

            myCommand = new SqlCommand(insertbill, myConnection);

            myConnection.Open();

            myCommand.ExecuteNonQuery();
        }
Ejemplo n.º 2
0
        public void AddGas(string AutoNumber, string Miles, string Price, string Gallons)
        {
            SqlCommand myCommand;

            if (Price.Length.Equals(0))
                Price = "0.0";

            string SQLInsertNewGas = "INSERT INTO Gas ([AutoNumber],[Miles],[Price],[Gallons]) VALUES ('{0}','{1}',{2},{3})";

            string insertbill = string.Format(SQLInsertNewGas, AutoNumber,Miles,Price,Gallons);

            myCommand = new SqlCommand(insertbill, myConnection);

            myConnection.Open();

            myCommand.ExecuteNonQuery();
        }