hi guys.
bit of a problem i have come across on my final page, i am taking information which are integers from drop down menus which are, in turn linked to their own data sources.
and then writing these intergers to a different table which are the same types (int) as the tables they are coming from, even then i am changing them to strings during the parameter:
<pre lang="cs">protected void confirmFixedHolButton0_Click(objectsender, EventArgs e)
{
using (conn)
{
conn.Open();
SqlCommand insertHolBooking = new SqlCommand("INSERT INTO [HolidayBooking] ([Customer ID], [Fixed Holiday ID], [Holiday ID], [Flight ID], [Holiday Tour ID])
VALUES
(@customerID, @fixHolID, @holID, @flightID, @holTourID)", conn);
insertHolBooking.CommandType = CommandType.Text;
insertHolBooking.Parameters.AddWithValue("@customerID", customerIDDDM.SelectedItem.ToString());
insertHolBooking.Parameters.AddWithValue("@fixHolID", fixedHolDDL.SelectedItem.ToString());
insertHolBooking.Parameters.AddWithValue("@holID", holidayIDDDM.SelectedItem.ToString());
insertHolBooking.Parameters.AddWithValue("@flightID", flightIDDDM.SelectedItem.ToString());
insertHolBooking.Parameters.AddWithValue("@holTourID", tourIDDDM0.SelectedItem.ToString());
try
{ conn.Open();
insertHolBooking.ExecuteNonQuery();
Response.Redirect("Bookings.aspx");
}
catch (Exception)
{ Response.Write("<b>Failed please try again.</b>");
}
}
}
it always throws the error message, cant see anything wrong with the SQL nor with the parameter.
The table this information is being written to is allowing nulls so i cant see the problem...
please help guys
Regards
Matt.