Insert into db fail

Results 1 to 2 of 2

Thread: Insert into db fail

  1. #1
    Join Date
    Dec 1969

    Default Insert into db fail

    Hi, I have set up 2 tables, client and business_type. When inserting from asp page using<BR>strSQL = "insert into client (bus_name,bus_id) values (&#039;werwewe&#039;,2)"<BR>all works ok<BR>When using <BR>strSQL = "insert into client (bus_name,bus_id) values (&#039;werwewe&#039;,"&bustype&")"<BR>it gets a page error. client is FK in relation to business type table.<BR>thanks for any advice

  2. #2
    Join Date
    Dec 1969

    Default RE: Insert into db fail

    Try Response.Write bustype see if ti comes out with 2 If so before the SQL do<BR><BR>bustype = CInt(bustype) which will ensure the code knows its an integer and not a string.<BR><BR>However if there is any change this number could go above 30,000 then use CLng instead of CInt

Posting Permissions

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