Click here to Skip to main content
15,885,537 members
Articles / Web Development / ASP.NET

SQL issue with inserting appointment

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
9 May 2012CPOL 3K  
application for appointmentI have A gridview with these columns AppId Appdate Starttime Endtime ConsumerAnd 2 dropdownlists below the gridview to select start time and end time to fix the appointment.I select the times and other values and click on insert buttonBefore...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
9 May 2012Sandeep Mewara
This simply means that either of below is false:starttime == Convert.ToDateTime(ds.Tables["t"].Rows[i][2].ToString()ORendtime == Convert.ToDateTime(ds.Tables["t"].Rows[i][3].ToString())If you are expecting both of them to be true in some scenario then DEBUG and see what's going wrong....
Please Sign up or sign in to vote.
9 May 2012Wendelius
To add to previous answer, you should never concatenate literals to SQL statements. This makes you vulnerable to SQL injections, data conversion mismatches etc. Use SqlParameter[^] instead.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions