Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old February 5th, 2008, 04:36 PM
Authorized User
Join Date: Aug 2006
Location: Hoffman Estates, IL, USA.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Mismatch Error

I'm getting a data mismatch error. I've traced it to my startdate and enddate, but can't figure out why.

' First let us create Connection and Recordset objects
Dim sCollege, sProgram, startdate, enddate

' A Function to check if some field entered by user is empty
Function ChkString(string)
    If string = "" Then string = " "
    ChkString = Replace(string, "'", "''")
End Function

startdate = ChkString(Request.Form("startdate"))
enddate = ChkString(Request.Form("enddate"))
sCollege = ChkString(Request.Form("school"))
sProgram = ChkString(Request.Form("program"))

' Open the connection to the ODBC source, in this case
' the Access database
<snipped because I know this is fine>

' Now, create the SQL statement
sSQL = "SELECT Session.Session, CourseInfo.CourseNumber, Reason.Reason, Request.Requestor, Request.Faculty, Request.SummaryOfRequest, Request.SummaryofChangesMade, Request.DateCompleted, CDPM.CDPMName, CourseInfo.College, CourseInfo.Program FROM [Session] INNER JOIN (Reason INNER JOIN (CourseInfo INNER JOIN (CDPM INNER JOIN Request ON CDPM.CDPMID = Request.CDPMID) ON CourseInfo.CourseID = Request.CourseID) ON Reason.ReasonID = Request.ReasonID) ON Session.SessionID = Request.SessionID WHERE College='" & sCollege & "' AND Program='" & sProgram & "' AND DateCompleted >='" & startdate & "' ORDER BY DateCompleted desc"
Anyone have an idea?

BTW, this is connecting to an Access database through ASP.

Thanks in advance,

Reply With Quote
  #2 (permalink)  
Old March 18th, 2008, 03:34 AM
Authorized User
Join Date: Sep 2003
Location: Delhi, Delhi, India.
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prabodh_mishra

One of the following should work:
  1. Use CDate() while concatenating sSQL
  2. Check Date variables if it is in acceptable (DD/MM) format for Access DB
  3. Use Access DB in-built Date conversion function in your sSQL string.

Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
hi i got runtime error 13 Type Mismatch error sriharsha345 Access VBA 2 February 21st, 2008 09:30 AM
error 3464 'data type mismatch in criteria express Vince_421 Access VBA 3 May 3rd, 2007 07:45 AM
Data Type Mismatch Error in Criteria Expression mmcdonal Access VBA 2 March 1st, 2007 05:18 PM
Data Type mismatch error clueless_may Access VBA 1 May 5th, 2004 10:16 AM
Data Type Mismatch error transcona Classic ASP Databases 4 June 25th, 2003 08:23 PM

All times are GMT -4. The time now is 12:29 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.