Code change from SQL - Access

Results 1 to 3 of 3

Thread: Code change from SQL - Access

  1. #1
    greg l Guest

    Default Code change from SQL - Access

    &nbsp;<BR>Hi,<BR><BR>I have tried to change the site database to an Access 97 one down from SQL. I&#039m having a problem with one of the pages. <BR>Could someone please tell me where I have got the code wrong. I have no problem with it in SQL so I have obviously missed something.<BR><BR>This ODBC source works ok and the rest of this site section is ok, it&#039s just this page.<BR><BR>regards greg<BR><BR><BR>&#060;%<BR>Set Con = Server.CreateObject("ADODB.Connection")<BR>Con.Ope n "DSN=database;UID=;PWD="<BR><BR>Query = "SELECT * FROM Employment WHERE tipID=&#039" & Request.QueryString & "&#039"<BR>Set RS=Con.Execute(Query)<BR>%&#062;<BR><BR><BR>ERROR MESSAGE below:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e07&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. <BR><BR>employment_tip.asp, line 14 <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Code change from SQL - Access

    data type of tipID may be numeric.<BR><BR>try it <BR><BR>Query = "SELECT * FROM Employment WHERE tipID=" & Request.QueryString

  3. #3
    Join Date
    Dec 1969

    Default RE: Code change from SQL - Access

    Hi, YOur help is really appreciated.<BR>I fixed that by buiding a new query in access and then exporting the HTML. Now Im having a problem on this other page. It is where a job is posted. I get this error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. <BR><BR>employment_add.asp, line 108 <BR><BR>Here is the main code and line 108 has this " Conn.Execute(Query)"<BR><BR>&#060;%<BR>Function Encode(strToEncode)<BR> strToEncode = Server.HTMLEncode(strToEncode)<BR> strToEncode = REPLACE(strToEncode, vbNewLine, "<BR>")<BR> Encode = strToEncode<BR>End Function<BR><BR>IF Request.Form("Title")="" THEN<BR> Caption = "Your Job Submission is appreciated, please go ahead and submit now.!"<BR>ELSE<BR><BR> Set Conn = Server.CreateObject("ADODB.Connection")<BR> "database","",""<BR><BR> Query = "INSERT Employment (author, journal, title, tip, salaryfrom, salaryto, EmployerID, city) VALUES (&#039" & Encode(Request.Form("Author")) & "&#039,&#039" & Encode(Request.Form("Journal")) & "&#039,&#039" & Encode(Request.Form("Title")) & "&#039,&#039" & Encode(Request.Form("Tip")) & "&#039,&#039" & Encode(Request.Form("Salaryfrom")) & "&#039,&#039" & Encode(Request.Form("Salaryto")) & "&#039,&#039" & Encode(Request.Form("EmployerID")) & "&#039,&#039" & Encode(Request.Form("city")) & "&#039)"<BR><BR> Conn.Execute(Query)<BR> Conn.Close<BR><BR> Caption = "Thank you, feel free to add another?"<BR>END IF<BR>%&#062;

Posting Permissions

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