public void SaveFlight(Flight flight)
{
using (SqlConnection sqlConnection = new SqlConnection(foo))
{
using (SqlCommand sqlCommand = new SqlCommand())
{
sqlCommand.CommandText = "dbo.AddFlight";
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Connection = sqlConnection;
sqlCommand.Parameters.AddWithValue("@Duration", flight.Duration);
sqlCommand.Parameters.AddWithValue("@DepartureTime", flight.DepartureTime);
sqlCommand.Parameters.AddWithValue("@DepartureCity", flight.DepartureCity);
sqlCommand.Parameters.AddWithValue("@DestinationCity",
flight.DestinationCity);
sqlConnection.Open();
sqlCommand.ExecuteScalar();
}
}
}
No comments:
Post a Comment