Updating multiple Records

Results 1 to 2 of 2

Thread: Updating multiple Records

  1. #1
    Mcd24 Guest

    Default Updating multiple Records

    Hi All,<BR><BR>I am trying to write a page that will allow you to do multiple updates at once. My Table is as follows:<BR><BR>employeeid<BR>personalday<BR>sickd ay<BR>vacationday<BR>floaterday<BR>idrec<BR><BR>My code that procces data from the form is below. I am not sure if I am going about this the right way. Any help is appreciated.<BR><BR>&#060;%@language="vbscript"%&# 062;<BR>&#060;%option Explicit%&#062;<BR>&#060;%response.buffer=true%&#0 62;<BR>&#060;!--#include file="adovbs.inc"--&#062;<BR>&#060;%<BR>&#039;Create Connection object and open it<BR>dim objConn<BR>set objConn= server.createobject("adodb.Connection")<BR>objConn .connectionString ="DSN=VacationDSN"<BR>objConn.open<BR>%&#062;<BR>< BR><BR><BR><BR>&#060;%<BR>Dim iLoop,strDataPer,personal(50),iCount2,Sick(50),vac ation(50),strDataSick,strDataVac,floater(50),strDa taFlo<BR>Dim idrec(50),StrDataIDrec,strSQL,objRS <BR> <BR> <BR> iCount2 = Request("daycounter")<BR> <BR>If Request.Form("update").Count &#062; 0 Then<BR><BR>set objRS=server.createobject("adodb.Recordset")<BR>ob jRS.open strSQL, objconn,adOpenkeyset,adLockOptimistic<BR> <BR> For iLoop = 0 to iCount2<BR> <BR> personal(Iloop)=request.form ("Personaltxt" & Iloop)<BR> StrDataPer = Split(Personal(Iloop), ",") <BR> <BR> <BR> Sick(Iloop)=request.form ("Sicktxt" & Iloop)<BR> strDatasick = Split(Sick(Iloop), ",") <BR> <BR> <BR> vacation(Iloop)=request.form ("vacationtxt" & Iloop)<BR> StrDataVac = Split(vacation(Iloop), ",") <BR> <BR><BR> floater(Iloop)=request.form ("floatertxt" & Iloop)<BR> StrDataFlo = Split(floater(Iloop), ",") <BR> <BR><BR> idrec(Iloop)=request.form ("idrectxt" & Iloop)<BR> StrDataIDrec= Split(idrec(Iloop), ",") <BR> <BR> <BR> strSQL="UPDATE vacationTable SET Personaltaken = &#039;" & StrDataPer & "&#039; WHERE id like &#039;2&#039; "<BR> <BR> Next<BR><BR><BR> <BR>end if<BR><BR><BR> <BR> <BR><BR><BR> %&#062; <BR> <BR> <BR>

  2. #2
    Join Date
    Dec 1969

    Default there's a better technique

    see the tutorial on http://www.infinitemonkeys.ws/ on using the IN clause<BR><BR>j

Posting Permissions

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