0

I want to insert data in a table

flight_reservation(reserve_id, customer_id, tariff_id, total_price, date)

Where reserve_id is an auto_id. Moreover tariff_id is from table fare_tariff and customer_id from table customer. I retrieved the tariff_id, total_price from database and date value from calender selection in reservation.aspx page, then passed it to confirm.aspx page. I want to execute my query in the end of registration.aspx page. So that I want to pass this three value in registration.aspx page. Now my problem is that, I successfully could pass the tariff_id and total_price to confirm.aspx page. But I couldn't pass the date value in the same manner.. In reservation page I used:

Response.Ridirect("confirm.aspx? &tariff_id= " + tariff_id + " &total_price= " + total_price+ " &date= " +date);

I could retrieve tariff_id and total_price in confirm.aspx page, but the date value couldn't retrieved, Here date is a variable which keep the string value selected from a calender control. Can anyone help me to retrieve the date value?

  • 1
    Do not create (or parse) a URL manually. It is too easy to mess up or have data that breaks it unexpectedly at some random time later. See http://stackoverflow.com/questions/829080/how-to-build-a-query-string-for-a-url-in-c (or if [it's a route](http://msdn.microsoft.com/en-us/library/cc668176(v=vs.100).aspx)) or similar - it's not as bad as creating SQL manually, but it stems from the same general problem of not using the correct abstraction layer. – user2246674 Apr 26 '13 at 04:36
  • confirm.aspx? & is not good...confirm.aspx?firstParam=1&secondparam=2 etc, also try to urlEncode variables. But the best solution would be to submit a FORM with POST method with hidden fields OR use CrossPostBack using Asp.net. – highwingers Apr 26 '13 at 05:00

1 Answers1

1

The one thing that really stands out to me is the spaces in the url. This could be causing problems when the target page is attempting to parse the date passed to it. I don't think this is what you want to do.

Try this instead:

Response.Ridirect("confirm.aspx?tariff_id=" + tariff_id + "&total_price=" + total_price+ "&date=" +date);
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331