473,414 Members | 1,738 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,414 software developers and data experts.

ASP script with upload files, want to add SQL statement

I have a Flash form that uses ASP to write to Access db. I have an HTML form that uses ASP to upload files and email those files and sends copies to recipients based on the form fields. I would like to also save all this data to an Access db and have created one that has all the same field names. I have copied my working SQL statement, modified with correct fields for new db and appended it to the bottom of my existing ASP email script. Good news, no errors, bad news SQL statement does not appear to be doing anything.

Am I in the right ballpark?

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Set upl    = Server.CreateObject("SoftArtisans.FileUp")
  3. upl.Path    = "D:\FTP\cincishop\Database\helpdesk_files"
  4.  
  5. 'senderName        = upl.form("senderName")
  6. 'senderEmail    = upl.form("senderEmail")
  7. 'senderSubject     = upl.form("senderSubject")
  8. 'senderText        = upl.form("senderText")
  9.  
  10. firstname = upl.form("firstname")
  11. lastname = upl.form("lastname")
  12. sender = upl.form("sender")
  13. phone = upl.form("phone")
  14. rep_firstname = upl.form("rep_firstname")
  15. rep_lastname = upl.form("rep_lastname")
  16. rep_sender = upl.form("rep_sender")
  17. rep_phone = upl.form("rep_phone")
  18. artist_firstname = upl.form("artist_firstname")
  19. artist_lastname = upl.form("artist_lastname")
  20. artist_sender = upl.form("artist_sender")
  21. advertiser = upl.form("advertiser")
  22. click_thru = upl.form("click_thru")
  23. acct_number = upl.form("acct_number")
  24. proof_needed = upl.form("proof_needed")
  25. start_date = upl.form("start_date")
  26. ad_type = upl.form("ad_type")
  27.  
  28. creative_regular01 = upl.form("creative_regular01")
  29. creative_regular02 = upl.form("creative_regular02")
  30. creative_regular03 = upl.form("creative_regular03")
  31. creative_regular04 = upl.form("creative_regular04")
  32. creative_regular05 = upl.form("creative_regular05")
  33. creative_regular06 = upl.form("creative_regular06")
  34. creative_regular07 = upl.form("creative_regular07")
  35. creative_regular08 = upl.form("creative_regular08")
  36. creative_regular09 = upl.form("creative_regular09")
  37. creative_regular10 = upl.form("creative_regular10")
  38. creative_regular11 = upl.form("creative_regular11")
  39. creative_regular12 = upl.form("creative_regular12")
  40. creative_regular13 = upl.form("creative_regular13")
  41. creative_regular14 = upl.form("creative_regular14")
  42. creative_type = upl.form("creative_type")
  43. creative_special01 = upl.form("creative_special01")
  44. creative_special02 = upl.form("creative_special02")
  45. creative_special03 = upl.form("creative_special03")
  46. creative_special04 = upl.form("creative_special04")
  47. creative_special05 = upl.form("creative_special05")
  48. creative_special06 = upl.form("creative_special06")
  49. creative_instruction = upl.form("creative_instruction")
  50.  
  51. upl.form("attach1").Save
  52. upl.form("attach2").Save
  53. upl.form("attach3").Save
  54. upl.form("attach4").Save
  55. upl.form("attach5").Save
  56.  
  57. senderFile1    = Mid(upl.form("attach1").UserFilename, InstrRev(upl.form("attach1").UserFilename, "\") + 1)
  58. senderFile2 = Mid(upl.form("attach2").UserFilename, InstrRev(upl.form("attach2").UserFilename, "\") + 1)
  59. senderFile3 = Mid(upl.form("attach3").UserFilename, InstrRev(upl.form("attach3").UserFilename, "\") + 1)
  60. senderFile4 = Mid(upl.form("attach4").UserFilename, InstrRev(upl.form("attach4").UserFilename, "\") + 1)
  61. senderFile5 = Mid(upl.form("attach5").UserFilename, InstrRev(upl.form("attach5").UserFilename, "\") + 1)
  62.  
  63.  
  64. Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  65.  
  66. Mailer.FromName    = firstname & " " & lastname 
  67. Mailer.FromAddress = "info@shopatcincinnati.com"
  68. Mailer.Subject = "Online Advertising: New ad creative - " & advertiser
  69. Mailer.RemoteHost = "scriptmail.intermedia.net" 
  70. Mailer.ReplyTo = sender
  71.  
  72. Mailer.AddAttachment "D:\FTP\cincishop\Database\helpdesk_files\" & senderFile1
  73. Mailer.AddAttachment "D:\FTP\cincishop\Database\helpdesk_files\" & senderFile2
  74. Mailer.AddAttachment "D:\FTP\cincishop\Database\helpdesk_files\" & senderFile3
  75. Mailer.AddAttachment "D:\FTP\cincishop\Database\helpdesk_files\" & senderFile4
  76. Mailer.AddAttachment "D:\FTP\cincishop\Database\helpdesk_files\" & senderFile5
  77.  
  78. ' IF YOU WANT MORE RECIPIENTS, JUST ADD MORE LINES LIKE THIS ONE BELOW.
  79. Mailer.AddCC firstname & " " & lastname, sender
  80. Mailer.AddCC rep_firstname & " " & rep_lastname, rep_sender
  81. Mailer.AddCC artist_firstname & " " & artist_lastname, artist_sender
  82.  
  83. 'THIS IS THE TEXT OF THE EMAIL. YOU CAN CHANGE THIS FORMATTING, AND ADD FIELDS AND INFO 
  84. 'IF YOU LIKE.  vbCrLf is a carriage return/line feed character.
  85.  
  86. EmailText = EmailText & "Submitted by: " & firstname & " " & lastname & vbCrLf
  87. EmailText = EmailText & "E-mail: " & sender & vbCrLf
  88. EmailText = EmailText & "Phone: " & phone & vbCrLf
  89. EmailText = EmailText & vbCrLf
  90. EmailText = EmailText & "Sales rep: " & rep_firstname & " " & rep_lastname & vbCrLf
  91. EmailText = EmailText & "E-mail: " & rep_sender & vbCrLf
  92. EmailText = EmailText & "Phone: " & rep_phone & vbCrLf
  93. EmailText = EmailText & vbCrLf
  94. EmailText = EmailText & "Artist: " & artist_firstname & " " & artist_lastname & vbCrLf
  95. EmailText = EmailText & "E-mail: " & artist_sender & vbCrLf
  96. EmailText = EmailText & vbCrLf
  97. EmailText = EmailText & "Advertiser: " & advertiser & vbCrLf
  98. EmailText = EmailText & "Click Thru: " & click_thru & vbCrLf
  99. EmailText = EmailText & "Account #: " & acct_number & vbCrLf
  100. EmailText = EmailText & "Proof Needed: " & proof_needed & vbCrLf
  101. EmailText = EmailText & "Start Date: " & start_date & vbCrLf
  102. EmailText = EmailText & "Ad Type: " & ad_type & vbCrLf
  103. EmailText = EmailText & vbCrLf
  104. EmailText = EmailText & "Regular Creative: " & creative_regular01 & vbCrLf
  105. EmailText = EmailText & "Regular Creative: " & creative_regular02 & vbCrLf
  106. EmailText = EmailText & "Regular Creative: " & creative_regular03 & vbCrLf
  107. EmailText = EmailText & "Regular Creative: " & creative_regular04 & vbCrLf
  108. EmailText = EmailText & "Regular Creative: " & creative_regular05 & vbCrLf
  109. EmailText = EmailText & "Regular Creative: " & creative_regular06 & vbCrLf
  110. EmailText = EmailText & "Regular Creative: " & creative_regular07 & vbCrLf
  111. EmailText = EmailText & "Regular Creative: " & creative_regular08 & vbCrLf
  112. EmailText = EmailText & "Regular Creative: " & creative_regular09 & vbCrLf
  113. EmailText = EmailText & "Regular Creative: " & creative_regular10 & vbCrLf
  114. EmailText = EmailText & "Regular Creative: " & creative_regular11 & vbCrLf
  115. EmailText = EmailText & "Regular Creative: " & creative_regular12 & vbCrLf
  116. EmailText = EmailText & "Regular Creative: " & creative_regular13 & vbCrLf
  117. EmailText = EmailText & "Regular Creative: " & creative_regular14 & vbCrLf
  118. EmailText = EmailText & vbCrLf
  119. EmailText = EmailText & "Creative Type: " & creative_type & vbCrLf
  120. EmailText = EmailText & vbCrLf
  121. EmailText = EmailText & "Special Creative: " & creative_special01 & vbCrLf
  122. EmailText = EmailText & "Special Creative: " & creative_special02 & vbCrLf
  123. EmailText = EmailText & "Special Creative: " & creative_special03 & vbCrLf
  124. EmailText = EmailText & "Special Creative: " & creative_special04 & vbCrLf
  125. EmailText = EmailText & "Special Creative: " & creative_special05 & vbCrLf
  126. EmailText = EmailText & "Special Creative: " & creative_special06 & vbCrLf
  127. EmailText = EmailText & vbCrLf
  128. EmailText = EmailText & "Creative Instruction: " & creative_instruction & vbCrLf
  129.  
  130.  
  131. Mailer.BodyText = EmailText
  132.  
  133. If Mailer.SendMail then
  134.  
  135.     Response.redirect("http://www.cincinnati.enq/advertising/online_success.asp") ' CHANGE THIS TO YOUR THANK YOU / FILE SUCCESS PAGE.
  136.  
  137. Else
  138.  
  139.     Response.redirect("http://www.cincinnati.enq/advertising/online_error.asp") ' CHANGE THIS TO YOUR ERROR PAGE.
  140.  
  141.     Set conn = Server.CreateObject("ADODB.Connection")
  142. conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
  143. "DBQ=\\content\main_data\onlineNewCreative.mdb;"  
  144.  
  145. SQL = "INSERT INTO table1 (senderName, rep_firstname, rep_lastname, artist_firstname, artist_lastname, advertiser, acct_number, proof_needed, start_date, ad_type, senderText) VALUES ('" & strsenderName & "','" & strrep_firstname & "','" & strartist_firstname & "','" & strartist_lastname & "','" & stradvertiser & "','" & stracct_number & "', '" & strproof_needed & "','" & strstart_date & "','" & strad_type & "','" & strsender_text & "')"
  146.  
  147.  
  148. conn.Execute SQL, recaffected
  149.  
  150.  
  151.  
  152. Response.Write(strsenderName) & "<br>"
  153. Response.Write(strrep_firstname) & "<br>"
  154. Response.Write(strrep_lastname) & "<br>"
  155. Response.Write(strartist_firstname) & "<br>"
  156. Response.Write(strartist_lastname) & "<br>"
  157. Response.Write(stradvertiser) & "<BR/><br/>"
  158. Response.Write(stracct_number) & "<br>"
  159. Response.Write(strproof_neede) & "<br>"
  160. Response.Write(strstart_date) & "<br>"
  161. Response.Write(strad_type) & "<br>"
  162. Response.Write(strsenderText) & "<br>"
  163. Response.Write(recAffected)
  164.  
  165.  
  166. End if
  167.  
  168.  
  169. %> 
  170.  
  171.  
Jan 16 '08 #1
1 2645
jhardman
3,406 Expert 2GB
the response.redirect line(s) is stopping the script (and sending the browser to a different page) before you do the db work. I would suggest doing the db work first, or at least before the response.redirect line(s). Let me know if this helps.

Jared
Jan 17 '08 #2

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

Similar topics

6
by: jmev7 | last post by:
Is there a script that will allow upload of multiple images at once to a FTP server, and simultaneously write that list to a MySQL table? I need to allow users to do something like this. Thanks.
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
2
by: jonathan184 | last post by:
Hi I am trying to create a shell script that will look for a contracthead file first and if the contract head file does not exist on day1 exit script. Now on day2 if contracthead exists or...
4
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
5
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
4
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.