Querystring values not matching with the SQL statement

Reply

Join Date: Jul 2008
Posts: 2
Reputation: veenum2 is an unknown quantity at this point 
Solved Threads: 0
veenum2 veenum2 is offline Offline
Newbie Poster

Querystring values not matching with the SQL statement

 
0
  #1
Jul 4th, 2008
Edit/Update records in the Access DB Using ASP


Hi im trying to update products related to company ID entered in the database each time a product is entered related to the that ID the ID gets repeated as im adding the record in a loop.
SO like i got 20 products for a Company ID = 86 each time the ID gets repeated and the specific product as well
now i want to edit the products list how would u do that
ive made a page where dere a edit link for each particular product for the company and im passing the querystring and the ID value and the value of that product on to the next page but im getting error in my sql statement
could anyone help me wid this .
IF i use ON ERROR RESUME NEXT i can see my values otherwise i get erros

here is the code for First Page : PList.asp

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="Connections/MyCon.asp" -->
  3. <%
  4. Dim Recordset1
  5. Dim Recordset1_cmd
  6. Dim Recordset1_numRows
  7.  
  8. Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
  9. Recordset1_cmd.ActiveConnection = MM_MyCon_STRING
  10. Recordset1_cmd.CommandText = "SELECT P.CompanyID, P.Total, D.Name FROM Products AS P, Details AS D WHERE P.CompanyID = D.CompanyID ORDER BY P.Prod_ID "
  11. Recordset1_cmd.Prepared = true
  12.  
  13. Set Recordset1 = Recordset1_cmd.Execute
  14. Recordset1_numRows = 0
  15. %>
  16. <%
  17. 'Dim Repeat1__numRows
  18. 'Dim Repeat1__index
  19.  
  20. 'Repeat1__numRows = 5
  21. 'Repeat1__index = 0
  22. 'Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
  23. %>
  24. <%
  25. Dim Repeat1__numRows
  26. Dim Repeat1__index
  27.  
  28. Repeat1__numRows = 10
  29. Repeat1__index = 0
  30. Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
  31. %>
  32. <%
  33. ' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
  34.  
  35. Dim Recordset1_total
  36. Dim Recordset1_first
  37. Dim Recordset1_last
  38.  
  39. ' set the record count
  40. Recordset1_total = Recordset1.RecordCount
  41.  
  42. ' set the number of rows displayed on this page
  43. If (Recordset1_numRows < 0) Then
  44. Recordset1_numRows = Recordset1_total
  45. Elseif (Recordset1_numRows = 0) Then
  46. Recordset1_numRows = 1
  47. End If
  48.  
  49. ' set the first and last displayed record
  50. Recordset1_first = 1
  51. Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  52.  
  53. ' if we have the correct record count, check the other stats
  54. If (Recordset1_total <> -1) Then
  55. If (Recordset1_first > Recordset1_total) Then
  56. Recordset1_first = Recordset1_total
  57. End If
  58. If (Recordset1_last > Recordset1_total) Then
  59. Recordset1_last = Recordset1_total
  60. End If
  61. If (Recordset1_numRows > Recordset1_total) Then
  62. Recordset1_numRows = Recordset1_total
  63. End If
  64. End If
  65. %>
  66.  
  67. <%
  68. ' *** Recordset Stats: if we don't know the record count, manually count them
  69.  
  70. If (Recordset1_total = -1) Then
  71.  
  72. ' count the total records by iterating through the recordset
  73. Recordset1_total=0
  74. While (Not Recordset1.EOF)
  75. Recordset1_total = Recordset1_total + 1
  76. Recordset1.MoveNext
  77. Wend
  78.  
  79. ' reset the cursor to the beginning
  80. If (Recordset1.CursorType > 0) Then
  81. Recordset1.MoveFirst
  82. Else
  83. Recordset1.Requery
  84. End If
  85.  
  86. ' set the number of rows displayed on this page
  87. If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
  88. Recordset1_numRows = Recordset1_total
  89. End If
  90.  
  91. ' set the first and last displayed record
  92. Recordset1_first = 1
  93. Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  94.  
  95. If (Recordset1_first > Recordset1_total) Then
  96. Recordset1_first = Recordset1_total
  97. End If
  98. If (Recordset1_last > Recordset1_total) Then
  99. Recordset1_last = Recordset1_total
  100. End If
  101.  
  102. End If
  103. %>
  104. <%
  105. Dim MM_paramName
  106. %>
  107. <%
  108. ' *** Move To Record and Go To Record: declare variables
  109.  
  110. Dim MM_rs
  111. Dim MM_rsCount
  112. Dim MM_size
  113. Dim MM_uniqueCol
  114. Dim MM_offset
  115. Dim MM_atTotal
  116. Dim MM_paramIsDefined
  117.  
  118. Dim MM_param
  119. Dim MM_index
  120.  
  121. Set MM_rs = Recordset1
  122. MM_rsCount = Recordset1_total
  123. MM_size = Recordset1_numRows
  124. MM_uniqueCol = ""
  125. MM_paramName = ""
  126. MM_offset = 0
  127. MM_atTotal = false
  128. MM_paramIsDefined = false
  129. If (MM_paramName <> "") Then
  130. MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
  131. End If
  132. %>
  133. <%
  134. ' *** Move To Record: handle 'index' or 'offset' parameter
  135.  
  136. if (Not MM_paramIsDefined And MM_rsCount <> 0) then
  137.  
  138. ' use index parameter if defined, otherwise use offset parameter
  139. MM_param = Request.QueryString("index")
  140. If (MM_param = "") Then
  141. MM_param = Request.QueryString("offset")
  142. End If
  143. If (MM_param <> "") Then
  144. MM_offset = Int(MM_param)
  145. End If
  146.  
  147. ' if we have a record count, check if we are past the end of the recordset
  148. If (MM_rsCount <> -1) Then
  149. If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
  150. If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
  151. MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
  152. Else
  153. MM_offset = MM_rsCount - MM_size
  154. End If
  155. End If
  156. End If
  157.  
  158. ' move the cursor to the selected record
  159. MM_index = 0
  160. While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
  161. MM_rs.MoveNext
  162. MM_index = MM_index + 1
  163. Wend
  164. If (MM_rs.EOF) Then
  165. MM_offset = MM_index ' set MM_offset to the last possible record
  166. End If
  167.  
  168. End If
  169. %>
  170. <%
  171. ' *** Move To Record: if we dont know the record count, check the display range
  172.  
  173. If (MM_rsCount = -1) Then
  174.  
  175. ' walk to the end of the display range for this page
  176. MM_index = MM_offset
  177. While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
  178. MM_rs.MoveNext
  179. MM_index = MM_index + 1
  180. Wend
  181.  
  182. ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  183. If (MM_rs.EOF) Then
  184. MM_rsCount = MM_index
  185. If (MM_size < 0 Or MM_size > MM_rsCount) Then
  186. MM_size = MM_rsCount
  187. End If
  188. End If
  189.  
  190. ' if we walked off the end, set the offset based on page size
  191. If (MM_rs.EOF And Not MM_paramIsDefined) Then
  192. If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
  193. If ((MM_rsCount Mod MM_size) > 0) Then
  194. MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
  195. Else
  196. MM_offset = MM_rsCount - MM_size
  197. End If
  198. End If
  199. End If
  200.  
  201. ' reset the cursor to the beginning
  202. If (MM_rs.CursorType > 0) Then
  203. MM_rs.MoveFirst
  204. Else
  205. MM_rs.Requery
  206. End If
  207.  
  208. ' move the cursor to the selected record
  209. MM_index = 0
  210. While (Not MM_rs.EOF And MM_index < MM_offset)
  211. MM_rs.MoveNext
  212. MM_index = MM_index + 1
  213. Wend
  214. End If
  215. %>
  216. <%
  217. ' *** Move To Record: update recordset stats
  218.  
  219. ' set the first and last displayed record
  220. Recordset1_first = MM_offset + 1
  221. Recordset1_last = MM_offset + MM_size
  222.  
  223. If (MM_rsCount <> -1) Then
  224. If (Recordset1_first > MM_rsCount) Then
  225. Recordset1_first = MM_rsCount
  226. End If
  227. If (Recordset1_last > MM_rsCount) Then
  228. Recordset1_last = MM_rsCount
  229. End If
  230. End If
  231.  
  232. ' set the boolean used by hide region to check if we are on the last record
  233. MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
  234. %>
  235. <%
  236. ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
  237.  
  238. Dim MM_keepNone
  239. Dim MM_keepURL
  240. Dim MM_keepForm
  241. Dim MM_keepBoth
  242.  
  243. Dim MM_removeList
  244. Dim MM_item
  245. Dim MM_nextItem
  246.  
  247. ' create the list of parameters which should not be maintained
  248. MM_removeList = "&index="
  249. If (MM_paramName <> "") Then
  250. MM_removeList = MM_removeList & "&" & MM_paramName & "="
  251. End If
  252.  
  253. MM_keepURL=""
  254. MM_keepForm=""
  255. MM_keepBoth=""
  256. MM_keepNone=""
  257.  
  258. ' add the URL parameters to the MM_keepURL string
  259. For Each MM_item In Request.QueryString
  260. MM_nextItem = "&" & MM_item & "="
  261. If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
  262. MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  263. End If
  264. Next
  265.  
  266. ' add the Form variables to the MM_keepForm string
  267. For Each MM_item In Request.Form
  268. MM_nextItem = "&" & MM_item & "="
  269. If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
  270. MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  271. End If
  272. Next
  273.  
  274. ' create the Form + URL string and remove the intial '&' from each of the strings
  275. MM_keepBoth = MM_keepURL & MM_keepForm
  276. If (MM_keepBoth <> "") Then
  277. MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
  278. End If
  279. If (MM_keepURL <> "") Then
  280. MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
  281. End If
  282. If (MM_keepForm <> "") Then
  283. MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
  284. End If
  285.  
  286. ' a utility function used for adding additional parameters to these strings
  287. Function MM_joinChar(firstItem)
  288. If (firstItem <> "") Then
  289. MM_joinChar = "&"
  290. Else
  291. MM_joinChar = ""
  292. End If
  293. End Function
  294. %>
  295. <%
  296. ' *** Move To Record: set the strings for the first, last, next, and previous links
  297.  
  298. Dim MM_keepMove
  299. Dim MM_moveParam
  300. Dim MM_moveFirst
  301. Dim MM_moveLast
  302. Dim MM_moveNext
  303. Dim MM_movePrev
  304.  
  305. Dim MM_urlStr
  306. Dim MM_paramList
  307. Dim MM_paramIndex
  308. Dim MM_nextParam
  309.  
  310. MM_keepMove = MM_keepBoth
  311. MM_moveParam = "index"
  312.  
  313. ' if the page has a repeated region, remove 'offset' from the maintained parameters
  314. If (MM_size > 1) Then
  315. MM_moveParam = "offset"
  316. If (MM_keepMove <> "") Then
  317. MM_paramList = Split(MM_keepMove, "&")
  318. MM_keepMove = ""
  319. For MM_paramIndex = 0 To UBound(MM_paramList)
  320. MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
  321. If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
  322. MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
  323. End If
  324. Next
  325. If (MM_keepMove <> "") Then
  326. MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
  327. End If
  328. End If
  329. End If
  330.  
  331. ' set the strings for the move to links
  332. If (MM_keepMove <> "") Then
  333. MM_keepMove = MM_keepMove & "&"
  334. End If
  335.  
  336. MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
  337.  
  338. MM_moveFirst = MM_urlStr & "0"
  339. MM_moveLast = MM_urlStr & "-1"
  340. MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
  341. If (MM_offset - MM_size < 0) Then
  342. MM_movePrev = MM_urlStr & "0"
  343. Else
  344. MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
  345. End If
  346. %>
  347. <html>
  348. <head>
  349. <title>...::: Company_Names with their Products...:::</title>
  350. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  351. </head>
  352.  
  353. <body>
  354. <strong>SHOWING <%=(Recordset1_first)%> TO <%=(Recordset1_last)%> RECORDS <br>
  355. </strong><br>
  356. <br>
  357. <br>
  358. <table width="588" height="27" align="center" bordercolor="#000000">
  359. <tr bgcolor="#CCFFFF">
  360. <td width="169"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Company
  361. ID</strong></font></td>
  362. <td width="149"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Company
  363. Name</strong></font></td>
  364. <td width="254"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Product
  365. Name(s) / List</strong></font></td>
  366. </tr>
  367. </table>
  368. <%
  369. While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
  370. %>
  371. <table width="588" height="27" align="center" bordercolor="#000000">
  372. <%
  373.  
  374.  
  375. 'set rsProd = Server.CreateObject("ADODB.Recordset")
  376. 'SQL = "SELECT * FROM Products "
  377. 'where CompanyID = " &rsComp("CompanyID")
  378. ' & "and Name is not null"
  379. 'RESPONSE.WRITE (SQL)
  380. 'response.end
  381. 'order by CompID, Total"
  382. 'rsProd.Open SQL , objConn , 1, 3
  383.  
  384. 'set rsComp = Server.CreateObject("ADODB.Recordset")
  385. 'SQLComp = "SELECT * From Details where CompanyID=" & rsProd("CompanyID") & "and Name is not null"
  386.  
  387. 'where CompanyID=" & rsProd("CompanyID") & "and Name is not null"
  388. 'order by CompID, Total"
  389. 'response.write SQLComp
  390. 'response.End()
  391. 'rsComp.Open SQLComp , objConn , 1, 3
  392.  
  393.  
  394. 'CName = rsComp("Name")
  395.  
  396. %>
  397. <%
  398. 'set rsComp = Server.CreateObject("ADODB.Recordset")
  399. 'SQLComp = "SELECT * From Details where CompanyID=" & rsProd("CompanyID") & "and Name is not null"
  400.  
  401. 'where CompanyID=" & rsProd("CompanyID") & "and Name is not null"
  402. 'order by CompID, Total"
  403. 'response.write SQLComp
  404. 'response.End()
  405. 'rsComp.Open SQLComp , objConn , 1, 3
  406.  
  407. 'CName = rsComp("Name")
  408. %>
  409. <% 'iRecordsShown = 1
  410. 'while not rsProd.EOF 'and iRecordsShown < rsProd.recordcount %>
  411. <tr>
  412. <td width="164" height="23" valign="top" bgcolor="#CCFFFF"><%=(Recordset1.Fields.Item("CompanyID").Value)%></td>
  413. <td width="150" valign="top" bgcolor="#CCFFFF"><%=(Recordset1.Fields.Item("Name").Value)%></td>
  414. <td width="258" valign="top" bgcolor="#CCFFFF"><%=(Recordset1.Fields.Item("Total").Value)%>
  415. <% 'response.write iRecordshown %> </td>
  416. <td width="258" valign="top" bgcolor="#CCFFFF"><div align="center"><a href="Edit_Pro_List.asp?id=<%= Recordset1("CompanyID") %>&Prod=<%=Recordset1("Total")%>">EDIT</a></div></td>
  417. </tr>
  418. <% 'end if
  419.  
  420. ' iRecordsShown = iRecordsShown + 1
  421.  
  422. 'rsProd.MoveNext
  423.  
  424. 'wend
  425.  
  426. 'rsProd.close
  427. 'set rsProd = Nothing
  428. 'objConn.close
  429. 'set objConn = Nothing
  430.  
  431.  
  432. %>
  433. </table>
  434. <%
  435. Repeat1__index=Repeat1__index+1
  436. Repeat1__numRows=Repeat1__numRows-1
  437. Recordset1.MoveNext()
  438. Wend
  439. %>
  440. <br>
  441. <br>
  442. TOTAL RECORDS FOUND: <%=(Recordset1_total)%> <br>
  443. <br>
  444. <% If MM_offset <> 0 Then %>
  445. <A HREF="<%=MM_moveFirst%>">First</A>
  446. <% End If ' end MM_offset <> 0 %>
  447.  
  448. <% If Not MM_atTotal Then %>
  449. <A HREF="<%=MM_moveNext%>">Next</A>
  450. <% End If ' end Not MM_atTotal %>
  451.  
  452. <% If MM_offset <> 0 Then %>
  453. <A HREF="<%=MM_movePrev%>">Previous</A>
  454. <% End If ' end MM_offset <> 0 %>
  455. <% If Not MM_atTotal Then %>
  456. <A HREF="<%=MM_moveLast%>">Last</A>
  457. <% End If ' end Not MM_atTotal %>
  458. </body>
  459. </html>
  460. <%
  461. Recordset1.Close()
  462. Set Recordset1 = Nothing
  463. %>


Second Page: Edit_Pro_List.asp

  1. <%
  2.  
  3. 'on error resume next
  4.  
  5. set objConn = Server.CreateObject("ADODB.Connection")
  6. NextID= request.QueryString("id")
  7. Prod = request.QueryString("prod")
  8. set rsNews = server.CreateObject("ADODB.Recordset")
  9. mydsn = "ArabNext"
  10. objConn.open mydsn
  11. sql = "Select * from Products where CompanyID=" &NextID & " And Total =" &Prod
  12.  
  13. response.write (SQL) & "<br>"
  14. 'response.end
  15.  
  16. 'for each items in request.QueryString
  17. 'response.write (items & " = " )
  18. 'response.write request.QueryString(items) & "<br>"
  19. 'Next
  20.  
  21. 'response.End()
  22.  
  23. rsNews.open sql, objConn, 1,3
  24. %>
  25.  
  26.  
  27. <html>
  28. <head>
  29. <title>..:::: EDIT PRODUCTS FORM ..::::</title>
  30. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  31. </head>
  32.  
  33. <body>
  34. <table width="473" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#0099FF">
  35. <tr>
  36.  
  37. <td width="469" bgcolor="#0099FF"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif"><strong>Edit
  38. Products Details ...</strong></font></td>
  39. </tr>
  40. <tr>
  41.  
  42. <td valign="top">
  43. <div align="center">
  44.  
  45. <form action="process_EditProdList.asp?ID=<%= NextID %>&Prod=<%= Prod %>" method="post" name="form1" onSubmit="MM_validateForm('txtTitle','','R','txtNews','','R');return document.MM_returnValue">
  46. <br>
  47.  
  48. <table width="95%" border="0" cellspacing="0" cellpadding="0">
  49. <tr>
  50. <td width="29%"><strong><font color="#0066FF" size="2" face="Verdana, Arial, Helvetica, sans-serif"> Product Name</font></strong></td>
  51. <td width="71%"><font color="#0066FF">
  52. <input name="PName" type="text" id="PName" value="<% = Prod %>" size="40">
  53. </font></td>
  54. </tr>
  55. <tr>
  56. <td colspan="2"><strong> <font color="#FFFFFF" size="1">.</font></strong> </td>
  57. </tr>
  58. <tr>
  59. <td colspan="2"><strong> <font color="#FFFFFF" size="1">.</font></strong> </td>
  60. </tr>
  61. <tr>
  62. <td colspan="2"><strong> <font color="#FFFFFF" size="1">.</font></strong> </td>
  63. </tr>
  64. <tr>
  65. <td>&nbsp;</td>
  66. <td><input name="Submit2" type="submit" onClick="MM_validateForm('Title','','R','Detail','','R','Rates','','R');return document.MM_returnValue" value="Edit-Products"></td>
  67. </tr>
  68. </table>
  69.  
  70. </form>
  71. </div></td>
  72. </tr>
  73. </table>
  74. </body>
  75. </html>




FINAL Page : Process_EditProdList.asp

  1. <%
  2. 'ON ERROR RESUME NEXT
  3.  
  4.  
  5.  
  6.  
  7. '-----------------------------------------------------------------
  8.  
  9. compid = request.QueryString("id")
  10. prodname = request.QueryString("Prod")
  11.  
  12. set objConn = Server.CreateObject("ADODB.Connection")
  13. myDSN = "ArabNext"
  14. objConn.Open myDSN
  15.  
  16. set rsTech = Server.CreateObject("ADODB.Recordset")
  17. SQL = "SELECT * FROM Products where CompanyID=" &compid & "And Total =" &prodname
  18.  
  19. rsTech.Open SQL , objConn , 1, 3
  20. response.write SQL
  21. response.End
  22.  
  23.  
  24. rsTech("Total") = (prodname) 'Request("PName")
  25.  
  26. rsTech.update
  27.  
  28.  
  29. 'rsTech.close
  30. 'set rsTech = nothing
  31.  
  32.  
  33. %>
  34.  
  35.  
  36. <html>
  37. <head>
  38. <title>::... Al-Rehman RentACar....::</title>
  39. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  40. <SCRIPT language=Javascript src="links.js">
  41. </SCRIPT>
  42. <script language="JavaScript" type="text/JavaScript">
  43.  
  44. <!--
  45. function MM_findObj(n, d) { //v4.01
  46. var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  47. d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  48. if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  49. for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  50. if(!x && d.getElementById) x=d.getElementById(n); return x;
  51. }
  52.  
  53. function MM_validateForm() { //v4.0
  54. var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  55. for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
  56. if (val) { nm=val.name; if ((val=val.value)!="") {
  57. if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
  58. if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
  59. } else if (test!='R') { num = parseFloat(val);
  60. if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
  61. if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
  62. min=test.substring(8,p); max=test.substring(p+1);
  63. if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
  64. } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  65. } if (errors) alert('The following error(s) occurred:\n'+errors);
  66. document.MM_returnValue = (errors == '');
  67. }
  68. //-->
  69. </script>
  70. </head>
  71.  
  72. <body bgcolor="#0099FF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  73. <div align="center">
  74. <table>
  75. <tr>
  76. <td> <% server.Execute("menu.asp")%> <br></td>
  77. </tr>
  78. <tr>
  79. <td><table width="44%" border="1" align="center" cellpadding="0" cellspacing="0">
  80. <tr>
  81. <td bgcolor="#FFFF00">&nbsp;</td>
  82. <td bgcolor="#FF3300">&nbsp;</td>
  83. <td bgcolor="#0000FF">&nbsp;</td>
  84. <td bgcolor="#660000">&nbsp;</td>
  85. <td bgcolor="#FF00FF">&nbsp;</td>
  86. </tr>
  87. </table>
  88. <div align="center"></div></td>
  89. </tr>
  90. <tr>
  91. <td>&nbsp;</td>
  92. </tr>
  93. <tr>
  94. <td bgcolor="#FFFFFF">
  95. <table align="center">
  96. <tr>
  97. <td bgcolor="#0099FF">
  98. <div align="center"><strong><font color="#FFFFFF" size="3" face="Garamond, Wingdings 3">The
  99. particual Company Details has been Edited Successfuly!<br>
  100. <br>
  101. </font><font color="#FFFFFF" size="2"><strong>THE DETAILS YOUVE EDITED IN THE DATABASE ARE LISTED BELOW</strong></font><font color="#FFFFFF" size="3" face="Garamond, Wingdings 3"><br>
  102. </font></strong>
  103. <table border="1" align="center">
  104. <caption>
  105. <em><strong><font face="Verdana, Arial, Helvetica, sans-serif"> &quot;Details </font></strong></em>
  106. &quot;
  107. </caption>
  108. <tr>
  109. <th width="107" align="left" scope="col"><font color="#FFFFFF">Product<strong> Name</strong></font></th>
  110. <th width="328" align="center" scope="col"><strong><font color="#FFFFFF" size="2">
  111. <%' = request("txtname") %>
  112. </font></strong></th>
  113. </tr>
  114. <tr>
  115. <th align="left" scope="col"><font color="#FFFFFF">Company_ID</font></th>
  116. <th align="center" scope="col">
  117. <font color="#FFFFFF" size="2"> ID :<strong>
  118. <%' = request.QueryString("id") %>
  119. </strong></font></th>
  120. </tr>
  121. </table>
  122. <strong><font color="#FFFFFF" size="3" face="Garamond, Wingdings 3"><br>
  123. </font></strong></div></td>
  124. </tr>
  125. </table>
  126. <table align="center" bordercolor="#FFFFFF">
  127. <tr>
  128. <th scope="col"><form name="form1" method="post" action="ah1_add.asp">
  129. <label>
  130. <input type="submit" name="button" id="button" value="Add More Data">
  131. </label>
  132. </form> </th>
  133. </tr>
  134. </table>
  135. <br>
  136. <br></td>
  137. </tr>
  138. </table>
  139. <br>
  140. <br>
  141. </div>
  142. <br>
  143. </body>
  144.  
  145.  
  146.  
  147. </html>
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 21
Reputation: ratri is an unknown quantity at this point 
Solved Threads: 1
ratri ratri is offline Offline
Newbie Poster

Re: Querystring values not matching with the SQL statement

 
0
  #2
Jul 10th, 2008
You can get a lot of information from the error message you are getting. If you can post the error message, I am sure someone out here can help you out; else it would be difficult to debug if there is no database schema to test against.

(to view the exact error message you are getting on IE, go to TOOLS->Internet Options -> Advanced and uncheck "show friendly HTTP error messages")
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC