trying to insert array into database

Results 1 to 2 of 2

Thread: trying to insert array into database

  1. #1
    Join Date
    Dec 1969

    Default trying to insert array into database

    I am trying to insert an array into a database and have a new database row for each new value. My problem is that I&#039;m getting the following error on my page: <BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)<BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression &#039;&#039;;)&#039;Cotton fabric&#039;.<BR>line 128<BR><BR>Here is the code that is generating the error:<BR> &#060;%<BR> &#039;put session array into variable localcart<BR>localcart= session("cart") <BR><BR>%&#062;<BR>&#060;% <BR> &#039; insert array into database<BR>dim objCmd<BR> set objCmd = server.createobject("adodb.command")<BR> objcmd.activeconnection = "dsn=mj_trends"<BR> <BR> for i = 0 to ubound(localcart)<BR> sqlstr = "insert into orderdetails(fabtype) values (&#039;"&sqlstr&";)&#039;" <BR> if localcart(cartpname, i)&#060;&#062;"" then<BR> sqlstr = sqlstr & localcart(cartpname, i)<BR> end if <BR><BR> objcmd.commandtext = sqlstr<BR> objcmd.execute <BR> next<BR> set objcmd = nothing<BR> %&#062;

  2. #2
    Join Date
    Dec 1969

    Default Try this sql...

    sqlstr = "insert into orderdetails(fabtype) values (&#039;" & sqlstr & "&#039;)"

Posting Permissions

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