Hello everyone.
I'm executing a stored procedure and I would like to know how do I trap errors if the there is something wrong I can you it to the user what's going on. Please see my code below
 
Tia
Charles
 
 
------------- code -------------

protected void Send_Reservation()

{

FbTransaction myTransaction;

FbConnection myConnection = new FbConnection(ConfigurationManager.ConnectionStrings["VCALIMO"].ConnectionString);

myConnection.Open();

myTransaction = myConnection.BeginTransaction();

FbCommand myCommand = new FbCommand("EXECUTE PROCEDURE INSERT_RESERVATION(@I_COMPANY_NAME, @I_PASSENGER_NAME, @I_PASSENGER_PHONE, @I_PASSENGER_EMAIL, @I_CALLER_NAME, @I_CALLER_PHONE, @I_CALLER_EMAIL, @I_RESERVATION_DATE, @I_RESERVATION_TIME, @I_VEHICLE_REQUESTED_ID, @I_NUMBER_OF_PAX, @I_PICKUP_LOCATION, @I_DROP_OFF_LOCATION, @I_PICKUP_AIRPORT, @I_PICKUP_AIRLINE, @I_PICKUP_FLIGHT, @I_PICKUP_INSTRUCTIONS, @I_PICKUP_OTHER_ADDRESS1, @I_PICKUP_OTHER_ADDRESS2, @I_PICKUP_OTHER_CITY, @I_PICKUP_OTHER_STATE, @I_PICKUP_OTHER_ZIPCODE, @I_PICKUP_OTHER_INSTRUCTIONS, @I_DROPOFF_AIRPORT, @I_DROPOFF_AIRLINE, @I_DROPOFF_FLIGHT, @I_DROPOFF_INSTRUCTIONS, @I_DROPOFF_OTHER_ADDRESS1, @I_DROPOFF_OTHER_ADDRESS2, @I_DROPOFF_OTHER_CITY, @I_DROPOFF_OTHER_STATE, @I_DROPOFF_OTHER_ZIPCODE, @I_DROPOFF_OTHER_INSTRUCTIONS, @I_PAYMENT_METHOD, @I_CREDIT_CARD_TYPE, @I_CREDIT_CARD_NUMBER, @I_CREDIT_CARD_HOLDER_NAME, @I_CREDIT_CARD_EXPIRATION_DATE, @I_CREDIT_CARD_SECURITY_CODE, @I_CREDIT_CARD_CHARGES_AGREED, @I_CORPORATE_ACCOUNT_NUMBER, @I_CHARGE_CODE)",

myConnection, myTransaction);

myCommand.Parameters.Add("@I_COMPANY_NAME", FbDbType.VarChar, 100, "I_COMPANY_NAME").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PASSENGER_NAME", FbDbType.VarChar, 100, "I_PASSENGER_NAME").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PASSENGER_PHONE", FbDbType.VarChar, 18, "I_PASSENGER_PHONE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PASSENGER_EMAIL", FbDbType.VarChar, 100, "I_PASSENGER_EMAIL").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CALLER_NAME", FbDbType.VarChar, 100, "I_CALLER_NAME").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CALLER_PHONE", FbDbType.VarChar, 18, "I_CALLER_PHONE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CALLER_EMAIL", FbDbType.VarChar, 100, "I_CALLER_EMAIL").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_RESERVATION_DATE", FbDbType.VarChar, 20, "I_RESERVATION_DATE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_RESERVATION_TIME", FbDbType.VarChar, 20, "I_RESERVATION_TIME").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_VEHICLE_REQUESTED_ID", FbDbType.VarChar, 10, "I_VEHICLE_REQUESTED_ID").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_NUMBER_OF_PAX", FbDbType.VarChar, 10, "I_NUMBER_OF_PAX").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_LOCATION", FbDbType.VarChar, 20, "I_PICKUP_LOCATION").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROP_OFF_LOCATION", FbDbType.VarChar, 20, "I_DROP_OFF_LOCATION").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_AIRPORT", FbDbType.VarChar, 50, "I_PICKUP_AIRPORT").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_AIRLINE", FbDbType.VarChar, 100, "I_PICKUP_AIRLINE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_FLIGHT", FbDbType.VarChar, 20, "I_PICKUP_FLIGHT").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_INSTRUCTIONS", FbDbType.VarChar, 300, "I_PICKUP_INSTRUCTIONS").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_OTHER_ADDRESS1", FbDbType.VarChar, 100, "I_PICKUP_OTHER_ADDRESS1").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_OTHER_ADDRESS2", FbDbType.VarChar, 50, "I_PICKUP_OTHER_ADDRESS2").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_OTHER_CITY", FbDbType.VarChar, 50, "I_PICKUP_OTHER_CITY").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_OTHER_STATE", FbDbType.VarChar, 20, "I_PICKUP_OTHER_STATE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_OTHER_ZIPCODE", FbDbType.VarChar, 10, "I_PICKUP_OTHER_ZIPCODE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PICKUP_OTHER_INSTRUCTIONS", FbDbType.VarChar, 300, "I_PICKUP_OTHER_INSTRUCTIONS").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_AIRPORT", FbDbType.VarChar, 50, "I_DROPOFF_AIRPORT").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_AIRLINE", FbDbType.VarChar, 100, "I_DROPOFF_AIRLINE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_FLIGHT", FbDbType.VarChar, 20, "I_DROPOFF_FLIGHT").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_INSTRUCTIONS", FbDbType.VarChar, 300, "I_DROPOFF_INSTRUCTIONS").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_OTHER_ADDRESS1", FbDbType.VarChar, 100, "I_DROPOFF_OTHER_ADDRESS1").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_OTHER_ADDRESS2", FbDbType.VarChar, 50, "I_DROPOFF_OTHER_ADDRESS2").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_OTHER_CITY", FbDbType.VarChar, 50, "I_DROPOFF_OTHER_CITY").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_OTHER_STATE", FbDbType.VarChar, 20, "I_DROPOFF_OTHER_STATE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_OTHER_ZIPCODE", FbDbType.VarChar, 10, "I_DROPOFF_OTHER_ZIPCODE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_DROPOFF_OTHER_INSTRUCTIONS", FbDbType.VarChar, 300, "I_DROPOFF_OTHER_INSTRUCTIONS").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_PAYMENT_METHOD", FbDbType.VarChar, 50, "I_PAYMENT_METHOD").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CREDIT_CARD_TYPE", FbDbType.VarChar, 50, "I_CREDIT_CARD_TYPE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CREDIT_CARD_NUMBER", FbDbType.VarChar, 50, "I_CREDIT_CARD_NUMBER").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CREDIT_CARD_HOLDER_NAME", FbDbType.VarChar, 100, "I_CREDIT_CARD_HOLDER_NAME").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CREDIT_CARD_EXPIRATION_DATE", FbDbType.VarChar, 50, "I_CREDIT_CARD_EXPIRATION_DATE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CREDIT_CARD_SECURITY_CODE", FbDbType.VarChar, 10, "I_CREDIT_CARD_SECURITY_CODE").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CREDIT_CARD_CHARGES_AGREED", FbDbType.VarChar, 10, "I_CREDIT_CARD_CHARGES_AGREED").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CORPORATE_ACCOUNT_NUMBER", FbDbType.VarChar, 50, "I_CORPORATE_ACCOUNT_NUMBER").Direction = ParameterDirection.Input;

myCommand.Parameters.Add("@I_CHARGE_CODE", FbDbType.VarChar, 50, "I_CHARGE_CODE").Direction = ParameterDirection.Input;

string ReservationHour, ReservationMinutes, ReservationTime;

ReservationHour = txReservationTime.DisplayText;

ReservationMinutes = txReservationAMPM.DisplayText;

ReservationTime = ReservationHour + ":" + ReservationMinutes;

string CreditCardExpiration, ExpireMonth, ExpireYear;

ExpireMonth = txExpirationMonth.DisplayText;

ExpireYear = txExpirationYear.DisplayText;

CreditCardExpiration = ExpireMonth + "/" + ExpireYear;

string CreditCardAgreement = "Y";

 

myCommand.Parameters[0].Value = txCompanyName.Text;

myCommand.Parameters[1].Value = txPassengerName.Text;

myCommand.Parameters[2].Value = txCompanyPhone.Text;

myCommand.Parameters[3].Value = txCompanyEmail.Text;

myCommand.Parameters[4].Value = txCallerName.Text;

myCommand.Parameters[5].Value = txCallerPhone.Text;

myCommand.Parameters[6].Value = txCallerEmail.Text;

myCommand.Parameters[7].Value = txReservationDate.DisplayText;

myCommand.Parameters[8].Value = ReservationTime;

myCommand.Parameters[9].Value = txVehicleSelection.DisplayText;

myCommand.Parameters[10].Value = txNumberOfPax.DisplayText;

myCommand.Parameters[13].Value = txPickupAirport.DisplayText;

myCommand.Parameters[14].Value = txPickupAirline.DisplayText;

myCommand.Parameters[15].Value = txPickupFlight.Text;

myCommand.Parameters[16].Value = txPickupInstructions.DisplayText;

myCommand.Parameters[17].Value = txPickupOtherAddress1.Text;

myCommand.Parameters[18].Value = PickupOtherAddress2.Text;

myCommand.Parameters[19].Value = txPickupOtherCity.Text;

myCommand.Parameters[20].Value = txPickupOtherState.DisplayText;

myCommand.Parameters[21].Value = txPickuOtherZipCode.Text;

myCommand.Parameters[22].Value = txPickupOtherInstructions.DisplayText;

myCommand.Parameters[23].Value = txDropOffAirport.DisplayText;

myCommand.Parameters[24].Value = txDropOffAirline.DisplayText;

myCommand.Parameters[25].Value = txDropOffFlight.Text;

myCommand.Parameters[26].Value = txDropOffInstructions.DisplayText;

myCommand.Parameters[27].Value = txDropOtherAddress1.DisplayText;

myCommand.Parameters[28].Value = txDropOffOtherAddress2.DisplayText;

myCommand.Parameters[29].Value = txDropOffOtherCity.DisplayText;

myCommand.Parameters[30].Value = txDropOffOtherState.DisplayText;

myCommand.Parameters[31].Value = txDropOffOtherZipCode.DisplayText;

myCommand.Parameters[32].Value = txDropOtherInstructions.DisplayText;

myCommand.Parameters[33].Value = txPaymentMethod.Text;

myCommand.Parameters[34].Value = txCreditCardType.DisplayText;

myCommand.Parameters[35].Value = txCreditCardNumber.DisplayText;

myCommand.Parameters[36].Value = txCreditCardHolder.DisplayText;

myCommand.Parameters[37].Value = CreditCardExpiration;

myCommand.Parameters[38].Value = txCardSecurityCode.DisplayText;

myCommand.Parameters[39].Value = CreditCardAgreement;

myCommand.Parameters[40].Value = txCorporateAccount.DisplayText;

myCommand.Parameters[41].Value = txChargeCode.DisplayText;

 

// Execute Update

myCommand.ExecuteScalar();

// Commit changes

myTransaction.Commit();

 

// Free command resources in Firebird Server

myCommand.Dispose();

// Close connection

myConnection.Close();

}

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to