Type Mismatch While Deleting Records

Results 1 to 7 of 7

Thread: Type Mismatch While Deleting Records

  1. #1
    Newbie Confused Guest

    Default Type Mismatch While Deleting Records

    I have a basic ASP page that collects two variables from a form. These 2 variables are used in the Query String to find the record to delete. However I keep getting a data type mis-match error when I try to delete a valid record. I used "Foward only", "Dynamic" and "Dynamic" along with "Optimistic" but nothing seems to work. By the way, this is the line that the error says it is occuring.<BR><BR>Please help!

  2. #2
    Join Date
    Dec 1969
    Posts
    1,019

    Default RE: Type Mismatch While Deleting Records

    The data type mismatch is related to the delete statement: ex:<BR>delete from myTbl WHERE numfield=&#039bob&#039<BR>&#039 and numfield is numeric will result in a mismatch<BR>make sure your WHERE is comparing numbers to numbers, text to text and using the correct syntax.<BR>If you can&#039t get it to work, please post the query causing the error.<BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    538

    Default RE: Type Mismatch Still Doesn't Work

    Here is my code. The variable resnum and lastname are entered in from a form page proceeding. resnum in my Access DB is an Autonumber if that matters.<BR><BR>&#060;% Response.Buffer = True<BR>Dim Connect, Delres, Query, lastname, resnum<BR><BR>resnum = Request.Form("Resnum")<BR>lastname = Request.Form("Callerslname")<BR><BR> Set Connect = Server.CreateObject("ADODB.Connection")<BR> Connect.Open "project"<BR> Set Delres = Server.CreateObject("ADODB.Recordset")<BR> Query = "SELECT * FROM project WHERE (((Resnum)=&#039" & resnum & "&#039) and ((Lname)=&#039" & lastname & "&#039));"<BR> Delres.Open Query, Connect,adOpenForwardOnly<BR> <BR>if Delres.EOF = true then <BR>Response.Redirect "http://www.te-ve.com/errordelete.htm"<BR>end if <BR> <BR>Delres.Delete<BR> <BR>Delres.Close<BR>Set Delres = nothing<BR><BR>%&#062;<BR><BR>I still am getting type mismatch error with this code. Please help.<BR><BR>Thanks

  4. #4
    Cable Guest

    Default RE: Type Mismatch Still Doesn't Work

    Is Resnum a text column or a numerical one? If it is a number, ie Integer, then drop the single quotes:<BR><BR>Query = "SELECT * FROM project WHERE (((Resnum)=" & resnum & ") and ((Lname)=&#039" & lastname & "&#039));"<BR>


  5. #5
    newby Guest

    Default RE: Maybe but.....

    Well I think that worked or maybe not. I am not getting this error:<BR><BR>The operation requested by the application is not supported by the provider. <BR><BR>this is reffering to the line that has<BR>Delres.Delete<BR><BR>Any suggestions?<BR>THanks for your help by the way

  6. #6
    Richard L. Guest

    Default RE: Maybe but.....

    Try out putting the Query string: response.write Query and cut and paste it off your web page into the Access SQL query page and run it there... see what errors it returns.<BR><BR>Also you could (in such a simple query), remove the parenthesis from the code Access writes – works the same and is easier for us to parse.<BR>

  7. #7
    Still Me Guest

    Default RE: Still Doesnt Work

    I am still getting the provider error I stated earlier.<BR><BR>any other suggestions, is it possible that my Access DB is set up in a way that wont allow deletes? I am self taught so dont know alot about Access and such<BR><BR>Any help is greatly appreciated and am willing to reward persons for getting my coding problems to work!<BR><BR>Please converse with me via e-mail on any further suggestions.<BR><BR>Thanks<BR>Kirk Ziegler<BR>kirk@talkvisual.com

Posting Permissions

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