Forums
This topic is locked
MultiDeletes/Updates
02 Mar 2002 12:36:56 jon badda posted:
Im using the most excellent 4GuysfromRolla tutorial for multiple updates/deleting found here @: www.4guysfromrolla.com/webtech/100199-2.shtml
On my site Im needing to update multiple records <b>and</b> multiple fields...
Any ideas on how this could be done using their code?
Replies
Replied 03 Mar 2002 16:21:03
03 Mar 2002 16:21:03 Owen Eastwick replied:
To update multiple fields, just modify the update portion of the code:
------------------------------------------------------------------------
strSQL = "UPDATE Products SET Cost = " & CDBl(strCost) & _
" WHERE ProductID = " & strID
------------------------------------------------------------------------
The update command format is like this:
UPDATE TableName SET Field1 = Value1, Field2 = Value2, Field3 = Value3 WHERE RecordID = ThisRecordID
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
------------------------------------------------------------------------
strSQL = "UPDATE Products SET Cost = " & CDBl(strCost) & _
" WHERE ProductID = " & strID
------------------------------------------------------------------------
The update command format is like this:
UPDATE TableName SET Field1 = Value1, Field2 = Value2, Field3 = Value3 WHERE RecordID = ThisRecordID
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 13 May 2004 09:07:05
13 May 2004 09:07:05 Jonatan Samuelsson replied:
Followed the tutorial on this page (part 1&2). I dont get it to work with multiple fields and records.... hmm. Please help me <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
____________________________________________________________
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/myconnection.asp" -->
<%
Response.Buffer = True
'First, we need to get the total number of items that could be updated
Dim iCount
iCount = Request.Form("Count"
'We need to obtain
Dim strOs, strOsv, strVplus, strV, strVvi, strVi, str3sid, strBla, strID
Dim strSQL
Dim Command1
set Command1 = Server.CreateObject("ADODB.Connection"
Command1.ConnectionString = myconnection
Command1.Open
Dim iLoop
For iLoop = 0 to iCount
strOs = Request(iLoop & ".os"
strOsv = Request(iLoop & ".osv"
strVplus = Request(iLoop & ".vplus"
strV = Request(iLoop & ".v"
strVvi = Request(iLoop & ".vvi"
strVi = Request(iLoop & ".vi"
str3sid = Request(iLoop & ".3sid"
strBla = Request(iLoop & ".bla"
strID = Request(iLoop & ".ID"
strSQL = "UPDATE furu SET os = " & strOs & ", osv = " & strOsv & " AND vplus = " & strVplus & " AND v = " & strV & " AND Vvi = " & strVvi & " AND vi = " & strVi & " AND 3sid = " & str3sid & " AND bla = " & strBla & "" &_
" WHERE Nr = " & strID
Command1.Execute strSQL
Next
Command1.Close
Set Command1 = Nothing
Response.Write "Links were updated ! One moment..."
%>
Edited by - powerpete on 13 May 2004 09:08:51
____________________________________________________________
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/myconnection.asp" -->
<%
Response.Buffer = True
'First, we need to get the total number of items that could be updated
Dim iCount
iCount = Request.Form("Count"
'We need to obtain
Dim strOs, strOsv, strVplus, strV, strVvi, strVi, str3sid, strBla, strID
Dim strSQL
Dim Command1
set Command1 = Server.CreateObject("ADODB.Connection"
Command1.ConnectionString = myconnection
Command1.Open
Dim iLoop
For iLoop = 0 to iCount
strOs = Request(iLoop & ".os"
strOsv = Request(iLoop & ".osv"
strVplus = Request(iLoop & ".vplus"
strV = Request(iLoop & ".v"
strVvi = Request(iLoop & ".vvi"
strVi = Request(iLoop & ".vi"
str3sid = Request(iLoop & ".3sid"
strBla = Request(iLoop & ".bla"
strID = Request(iLoop & ".ID"
strSQL = "UPDATE furu SET os = " & strOs & ", osv = " & strOsv & " AND vplus = " & strVplus & " AND v = " & strV & " AND Vvi = " & strVvi & " AND vi = " & strVi & " AND 3sid = " & str3sid & " AND bla = " & strBla & "" &_
" WHERE Nr = " & strID
Command1.Execute strSQL
Next
Command1.Close
Set Command1 = Nothing
Response.Write "Links were updated ! One moment..."
%>
Edited by - powerpete on 13 May 2004 09:08:51
Replied 13 May 2004 09:49:50
13 May 2004 09:49:50 Jonatan Samuelsson replied:
i guess the problem is in the update code... But why? i just added some more fields there!
...trying to use this:
www.dmxzone.com/showDetail.asp?TypeId=2&NewsId=1714
Edited by - powerpete on 13 May 2004 10:00:07
...trying to use this:
www.dmxzone.com/showDetail.asp?TypeId=2&NewsId=1714
Edited by - powerpete on 13 May 2004 10:00:07
Replied 13 May 2004 10:17:08
13 May 2004 10:17:08 Vince Baker replied:
From the fields you have listed in your sql statement, are they all numerical? If not, list the text fields here and the numerical ones and i will correct your sql...
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 13 May 2004 15:14:41
13 May 2004 15:14:41 Owen Eastwick replied:
Here's another tutorial for you to take a look at: www.drdev.net/article11.asp
Regards
Owen.
-------------------------------------------------------------------------------------------
Developer services and tutorials: www.drdev.net
Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
Regards
Owen.
-------------------------------------------------------------------------------------------
Developer services and tutorials: www.drdev.net
Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
Replied 14 May 2004 08:44:23
14 May 2004 08:44:23 Jonatan Samuelsson replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
From the fields you have listed in your sql statement, are they all numerical? If not, list the text fields here and the numerical ones and i will correct your sql...
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
they are all numerical... so i don't se why it shouldn't work <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
From the fields you have listed in your sql statement, are they all numerical? If not, list the text fields here and the numerical ones and i will correct your sql...
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
they are all numerical... so i don't se why it shouldn't work <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
Replied 14 May 2004 08:46:00
14 May 2004 08:46:00 Jonatan Samuelsson replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Here's another tutorial for you to take a look at: www.drdev.net/article11.asp
Regards
Owen.
-------------------------------------------------------------------------------------------
Developer services and tutorials: www.drdev.net
Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
i will look at it...
Here's another tutorial for you to take a look at: www.drdev.net/article11.asp
Regards
Owen.
-------------------------------------------------------------------------------------------
Developer services and tutorials: www.drdev.net
Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
i will look at it...
Replied 17 May 2004 12:23:47
17 May 2004 12:23:47 Jonatan Samuelsson replied:
what the F*** is wrong, cant get it to work....
syntax error in update expression
'80040e14
all fields i wan't to update are numerical, so no ' here
crying for help...
syntax error in update expression
'80040e14
all fields i wan't to update are numerical, so no ' here
crying for help...
Replied 17 May 2004 12:28:33
17 May 2004 12:28:33 Jonatan Samuelsson replied:
is i possible to use access with this....
Replied 17 May 2004 14:37:09
17 May 2004 14:37:09 Jonatan Samuelsson replied:
is i possible to use access with this....