Note that there are some explanatory texts on larger screens.

plurals
  1. POVBScript - Database - Recordset - How to pass DateDiff value in the database
    primarykey
    data
    text
    <p>I'm using DateDiff() function of ASP to find the date difference between two dates.</p> <p>The Function works fine and displays the exact date difference between two dates but when it comes to insert this value in the database it takes 9 as the value irrespect of any date difference.</p> <p>Suppose difference between two dates is more than 15 or 20 days, in the database it takes "9".</p> <p>I have used INT as the DATA TYPE for the column where it displaying the date difference.</p> <p>Is DATA TYPE creating an issue here? I even tried using session variable to store the value but no luck - here's my code below:</p> <pre class="lang-vb prettyprint-override"><code>if request.Form("sub") &lt;&gt; "" then sql = "Select * from emp_leave_details" rs.open sql , con, 1, 2 dim diff dim todate dim fromdate fromdate= rs("leave_from") todate= rs("leave_to") session("date_diff")=datediff("d",fromdate,todate) rs.addnew rs("emp_name") = request.Form("name") rs("emp_no") = request.Form("number") rs("address") = request.Form("address") rs("contact_no") = request.Form("contact") rs("mobile_no") = request.Form("mobile") rs("contact_onleave") = request.Form("contact_details") rs("leave_type") = request.Form("rad") rs("other_leave_details") = request.Form("PS") rs("leave_from") = request.Form("from") rs("leave_to") = request.Form("to") rs("applied_by") = request.Form("apply") rs("accepted_by") = request.Form("accept") rs("approved_by") = request.Form("approve") rs("no_of_leave_taken")= session("date_diff") rs.update response.Write("&lt;script language='javascript'&gt;{update();}&lt;/script&gt;") rs.close end if </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload