473,383 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Update records

347 100+
I am trying to update multiple records in 1 hit, i have a page that sends the info to an update page with ids for the records generated with a count, these are mp31, mp32 etc and also an id for the text i want updated, this is just a number to represent the order the mp3s are listed in on the site this is textfield1, textfield2 etc

my code on the update page is

Expand|Select|Wrap|Line Numbers
  1. Dim iCount
  2. iCount = Request.Form("mp3count")
  3. Dim strLink, strID
  4.  
  5. Set mp3Connection=Server.CreateObject("ADODB.Connection")
  6. DatabaseDetails="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("../../private/yaketynew.mdb") & ";"
  7. mp3Connection.Open DatabaseDetails
  8.  
  9. Dim iLoop
  10. For iLoop = 0 to iCount
  11. strLink = Request(iLoop & ".orderno")
  12. strID = Request(iLoop & ".idmp3")
  13. response.write(strID)
  14. response.write(strLink)
  15.  
  16. strSQL = "UPDATE mp3 SET orderno = ' " & strLink & " ' " & " WHERE idnumbermp3 = " & strID
  17. Response.write(strSQL)
  18. set mp3Recordset=mp3Connection.Execute(strSQL)
  19. Next
  20.  
  21. mp3connection.Close
  22. Set mp3connection = Nothing
i am getting the following error with the response write of the sql update

UPDATE mp3 SET orderno = ' ' WHERE idnumbermp3 =
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'idnumbermp3 ='.

/admin/updateok.asp, line 32
can anyone point me in the right direction

line 32 is

Expand|Select|Wrap|Line Numbers
  1. set mp3Recordset=mp3Connection.Execute(strSQL)
Mar 2 '10 #1
4 1806
jhardman
3,406 Expert 2GB
Problem is there is nothing in the inputs some of the times thru the loop. At the beginning of the loop check to see if the inputs are populated. Let me know if this helps.

Jared
Mar 3 '10 #2
colinod
347 100+
i think i have the fields populated now, but now i have a new problem the reponse.write of the sql query is this

UPDATE celebs SET bioginfo='Very versatile fabulous young actor - from middle class Indian to street cool or Northern. Since his screen debut in 2005 Riz has starred in award-winning film and TV including Michael Winterbottom's ‘Road to Guantanamo' (Berlin Silver Bear), Peter Kosminsky's ‘Britz' (BAFTA + RTS winner, Emmy nominated), ‘Dead Set' (BAFTA nominated), and 'Shifty' - for which he was nominated for Best Actor at the 2009 BIFA. Forthcoming screen appearances include Sally Potter's next feature alongside Jude Law, Steve Buscemi and Judy Dench. Riz is also an independent music artist under the name Riz MC. He has topped underground music charts and held an artistic residency at the Southbank Centre, been banned from - as well as championed on - national radio; supported Mos Def, Dizzee Rascal, and Massive Attack; played clubs and concerts from Fabric to the Royal Festival Hall, and been invited to play prominent slots at Glastonbury, BBC Electric Proms, and on several US tours.' and idnumber=317 and selectnum=317 and voicea='All' and voiceb='Indian' and voicec='' and voiced='' and voicee='' and voicef='' and voiceg='' and voiceh='' and voicei='' and voicej='' and voicek='' and voicel='' and voicem='' and voicen='' and voiceo='' and alternatives='Amerjit Deu
Kayvan Novak' and voicedesc='' and celeb='n' and marketingtext='Road to Guantanamo
Britz
Shifty
Dead Set' and marketingorder='30' and mailmp3='AHMED - ID FRAUD (VARIOUS INDIAN NORTHERN STREET).mp3' and scottishmailout='' and irishmailout='' and usamailout='' and geordiemailout='' where idnumber = 301

which is right, the text contains some html for ease of formatting individual words but i get this error

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''Very versatile fabulous young actor - from middle class Indian to street cool or Northern. Since his screen debut in 2005 Riz has starred in award-winning film and TV including Michael Winterbottom's <B>‘Road to Guantanamo'</B> (Berlin Silver Bear), Pete'.

/admin/updateok.asp, line 41

is this still the same problem as the error code is the same?
Mar 3 '10 #3
colinod
347 100+
Figured out its all to do with the straign inverted commas in the text, does anyone know how to replace straign inverted commas with code
Mar 3 '10 #4
jhardman
3,406 Expert 2GB
You are correct, the "'" symbol is reserved in SQL. I prefer to use a dynamic recordset, you can set the value of each field and then call the recordset's update() method, that way you don't have to build really hairy update statements.

however, the easiest way to change characters in ASP is with a replace() statement
Expand|Select|Wrap|Line Numbers
  1. updateStr = replace(updateStr, "'", "'")
Jared

PS the code I typed in was changed by the forum software to show an inverted comma. The second inverted comma in the above replace statement should be the following (which I am splitting up so that the Bytes forum software doesn't change to an inverted comma)
Expand|Select|Wrap|Line Numbers
  1. &
  2. #
  3. 39
  4. ;
Mar 4 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Reply via newsgroup | last post by:
Folks, When performing an update in mysql (using PHP), can I find out how many records were matched? mysql_affected_rows() won't work... and I have the following problem that I thought I...
1
by: Google Mike | last post by:
I have one table of new records (tableA) that may already exist in tableB. I want to insert these records into tableB with insert if they don't already exist, or update any existing ones with new...
2
by: serge | last post by:
/* This is a long post. You can paste the whole message in the SQL Query Analyzer. I have a scenario where there are records with values pointing to wrong records and I need to fix them using an...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
1
by: Michelle | last post by:
Hi all I am having problems creating an update query. I have 2 tables, tblPublishRoster and tblCCAgents_Changed_Shifts. I want to select all records from tblCCAgents_ChangedShifts where...
1
by: Earl Anderson | last post by:
Using WinXP & AccessXP, I'd like to automatically have the records that I've just printed in a report automatically updated to have the 'print date & time' immediately inserted into a 'Date/Time'...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
3
by: Roy | last post by:
Hi Access gurus, I have a A2K application.The data in the database is updated daily by a excel download.I have a master n related tables keyed in by a OrderID.I have a problem in updating data.If...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.