add to database problem

Results 1 to 2 of 2

Thread: add to database problem

  1. #1
    Join Date
    Dec 1969

    Default add to database problem

    Hi,<BR><BR>I have a problem with adding a checkbox value to my database.<BR>I have a field called newbooks in my database and it has a yes/no<BR>data type.<BR><BR>On my asp page I have a checkbox form called Newbooks and it has the value true.<BR><BR>On another asp page I have request.form("Newbooks") and a connection to the database were I select the required fields.<BR><BR>I keep getting this error:<BR><BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)<BR>[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.<BR>/bookstore/asp/Admin/AddBook2.asp, line 64<BR><BR><BR>Browser Type:<BR>Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) <BR><BR>Page:<BR>POST 95 bytes to /bookstore/asp/Admin/AddBook2.asp<BR><BR>POST Data:<BR>Title=dfgd&Summery=dgdf&Price=23&ThemeID= 4&AuthorID=7&Picture=fsd.jpg&Newbooks=on&submit=Su bmit <BR><BR>Why do I have a datatype mismatch. What should I put, is it the value "true" that is wrong?<BR><BR>Thanks for your help<BR>Kelly

  2. #2
    Join Date
    Dec 1969

    Default RE: add to database problem

    Unfortunately Kelly, a checkbox returns the values "on" and "off". So when writing these values into your table you have to do:<BR><BR>if value = "on" then<BR>writeBooleon = true<BR>else<BR>writeBooleon = false<BR>end if<BR>SQL = INSERT into tableName VALUES ("writeBooleon, othervalue")<BR><BR>I&#039;m pretty sure this is how it works, personally I just use two radio buttons with the values true and false, its easier and I think it looks better.

Posting Permissions

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