Curing Data Mismatch, Long Integer vs. Text

Results 1 to 3 of 3

Thread: Curing Data Mismatch, Long Integer vs. Text

  1. #1
    Join Date
    Dec 1969

    Default Curing Data Mismatch, Long Integer vs. Text

    The following query script:<BR><BR>DELETE FROM Tasks<BR>WHERE TaskID=&#039;::TaskID::&#039;<BR><BR>Yields a Data Mismatch error. That&#039;s not surprising, because the TaskID field in my database is an autoincrement field in Access, and is thus a LongInteger data type. The TaskID value that I am passing to the .asp page is text. <BR><BR>1. Is there a command to convert either or both of the data types?<BR><BR>2. On a scale of 1 to 10, how lame is my workaround: I created a "shadow" of the TaskID field (called ShadowTaskID) in the database that gets its values from the TaskID field, but the data type is text. It works perfectly, but it&#039;s clunky and ineffecient.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Curing Data Mismatch, Long Integer vs. Text

    If I&#039;m not mistaken, all you have to do is omit the single quotes like so...<BR><BR>"DELETE FROM Tasks WHERE TaskID = " & taskid<BR><BR>When you surround a value with single quotes, it treats it as a text string.

  3. #3
    Join Date
    Dec 1969

    Default What are you talking about????

    Just do<BR><BR>&#060;%<BR>TaskID = 17 &#039; or whatever or however you get it<BR>SQL = "DELETE FROM Tasks WHERE TaskID = " & TaskId<BR>conn.Execute( SQL )<BR>%&#062;<BR><BR>Just don&#039;t put the &#039;...&#039; around the number and all is done.<BR><BR>And it doesn&#039;t matter whether you do<BR><BR>&#060;%<BR>TaskID = 17<BR>%&#062;<BR>OR<BR>&#060;%<BR>TaskID = " &nbsp; &nbsp; &nbsp; 17 &nbsp; &nbsp; &nbsp; "<BR>%&#062;<BR><BR>Since, after all, when you construct the SQL query it all becomes a string, anyway, and spaces (outside &#039;...&#039; strings) don&#039;t matter in SQL queries.<BR><BR>

Posting Permissions

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