Databse Error

Results 1 to 3 of 3

Thread: Databse Error

  1. #1
    Join Date
    Dec 1969

    Default Databse Error

    Please help asap.<BR><BR>I got this error...<BR><BR>Microsoft JET Database Engine error &#039 80040e07&#039 <BR><BR>Data type mismatch in criteria expression. <BR><BR>/jargonsoft/testdocs(2)/download/download.asp, line 19 <BR><BR><BR>Here is line 19...<BR><BR>set rs = conn.Execute("SELECT * FROM users WHERE username =&#039" & Request.QueryString("U") & "&#039 AND " & Request.QueryString("PID") & " =&#039True&#039")<BR><BR>Here is the querystring...<BR><BR>http://localhost/jargonsoft/testdocs(2)/download/download.asp?U=jeremy&PID=readerx&LINK=READERX48_0 719.ZIP<BR><BR>I have an access 2000 db with the readerx field the little check box that is checked = True unchecked = False.<BR><BR>jeremy is a true username who owns the product which = true.<BR><BR><BR>Here is the rest of download.asp incase.<BR><BR>&#060;%@ LANGUAGE="VBSCRIPT" %&#062;<BR>&#060;%<BR>response.buffer = true<BR>Sub Main()<BR>If Session("loggedIn") = "" then<BR>response.redirect "login.asp?error=Session Expired. Login Again."<BR>End If<BR>End Sub<BR>Call Main<BR><BR>Dim conn<BR>Dim rs<BR>Dim strsql<BR><BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>set rs = server.CreateObject("ADODB.Recordset")<BR>conn.ope n "provider=microsoft.jet.oledb.4.0;data source=c:passwordspassword.mdb"<BR><BR>set rs = conn.Execute("SELECT * FROM users WHERE username =&#039" & Request.QueryString("U") & "&#039 AND " & Request.QueryString("PID") & " =&#039On&#039")<BR><BR>If (not rs.BOF) and (not rs.EOF) then<BR>Dim filesys, peoplefile<BR>Set filesys = CreateObject("Scripting.FileSystemObject")<BR>Set peoplefile = _<BR>filesys.OpenTextFile(_<BR>"c:inetpubwwwrootdo wnloadupdate.txt",_<BR>8, true)<BR>peoplefile.WriteLine "Time: " & now<BR>peoplefile.WriteLine "User: " & Request.QueryString("U")<BR>peoplefile.WriteLine "Took: " & Request.QueryString("LINK") & " of " & Request.QueryString("PID")<BR>peoplefile.WriteLine Response.Write("<BR><BR>")<BR>peoplefile.Close<BR> Response.Redirect "" & Request.QueryString("PID") & "/" & Request.QueryString("LINK")<BR>else<BR>Response.Re direct "login.asp?error=Access Denied."<BR>end if<BR><BR>rs.close<BR>set rs = nothing<BR><BR>conn.close<BR>set conn = nothing<BR><BR>&#039 Protected Download System V3<BR>&#039 This page is coyrighted (C) 1998-2000 Jeremy Pirlet.<BR>%&#062;<BR><BR><BR>&#060;HEAD&#062;<BR> &#060;META name="GENERATOR" content="Microsoft FrontPage 4.0"&#062;<BR>&#060;META name="ProgId" content="FrontPage.Editor.Document"&#062;<BR>&#060 ;/HEAD&#062;<BR><BR>

  2. #2
    Paul M Guest

    Default RE: Databse Error

    I think you are just missing some close quotes try this code:<BR><BR>set rs = conn.Execute("SELECT * FROM users WHERE username =&#039" & Request.QueryString("U") & "&#039 AND &#039" & Request.QueryString("PID") & "&#039 & "=True"<BR><BR>I think, the problem is definelty due to &#039 marks<BR><BR>Paul M<BR><BR>

  3. #3 Guest

    Default RE: Databse Error

    For a start if you had put your SQL Command into a string variable and displayed the string using response.write, you would have seem the problem.<BR><BR>According to the querystring you have shown,<BR><BR>Request.QueryString("PID") equals "readerx" and <BR>Request.QueryString("U") equals "jeremy", <BR>so the SQLCommand you have build would be:<BR><BR>SELECT * FROM users WHERE username =&#039jeremy&#039 AND readerx =&#039True&#039<BR><BR>I am not sure what you were trying to do, but the problem is in the second part of the where clause after the "AND". I think that you meant to test the value of Request.QueryString("PID") against one of your table fields, but instead you have put the value of that variable where a field name should have been, and this is what is causing the error. You have told the db to do a test involving an object called "readerx", which does not exist in the db.<BR><BR>If that is not the case then maybe you should have done some test on the value of Request.QueryString("PID") in your ASP code and not in your SQL Statement.<BR><BR>The answer given by Paul M does not seem to make much sense either. Maybe you need to explain just what you were trying to achieve in line 19.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts