Results 1 to 4 of 4

Thread: William

  1. #1
    William Guest

    Default William

    Using a multi select list box to Insert records. I have tried various methods including Inserts and an array but to no avail. Anyone have a sample of Inserting to a table multiple selections using a list box.

  2. #2
    Eddie Campbell Guest

    Default RE: William

    &nbsp;<BR>For Each Item In Request.Form("MyListBox")<BR>Sql = "Inset into MyTable(MyFieldName) VALUES (" & item & ")"<BR>&#039; now run the Sql<BR>Next

  3. #3
    William Guest

    Default RE: William

    Eddie.<BR><BR>Thanks for the code. However the following error is coming in<BR>Error Type:<BR>Microsoft VBScript runtime (0x800A01B6)<BR>Object doesn&#039;t support this property or method: &#039;Execute&#039;<BR>line 47<BR><BR>Conn.Execute(Sql) ???<BR><BR>I have opened a simple connection and cant seem to see the problem. Maybe its a case of cant see the trees for the wood here as this is the final installment in a bigger project.

  4. #4
    Eddie Campbell Guest

    Default RE: William

    This works fine on my server.<BR><BR>Set dbConn = Serve.CreateObject("ADODB.Connection")<BR>dbConn.C onnectString = "DRIVER={Microsoft Access Driver (*.Mdb)};DBQ=C:inetpubwwwrootmydb.mdb;"<BR>dbConn. Open<BR><BR>For Each Item In Request.Form("MyListBox") <BR>dbConn.Execute = "Insert into MyTable(MyFieldName) VALUES (" & item & ")" <BR>Next

Posting Permissions

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