salim
-
Posts
8 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by salim
-
-
I am not quite sure but here is the problem now, it sayss "no records found"look at the red part, maybe it's in there ?<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include file="Connections/connection1.asp" --><%' *** Edit Operations: declare variablesDim MM_editActionDim MM_abortEditDim MM_editQueryDim MM_editCmdDim MM_editConnectionDim MM_editTableDim MM_editRedirectUrlDim MM_editColumnDim MM_recordIdDim MM_fieldsStrDim MM_columnsStrDim MM_fieldsDim MM_columnsDim MM_typeArrayDim MM_formValDim MM_delimDim MM_altValDim MM_emptyValDim MM_iMM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Request.QueryStringEnd If' boolean to abort record editMM_abortEdit = false' query string to executeMM_editQuery = ""%><%' *** Delete Record: declare variablesif (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_connection1_STRING MM_editTable = "Products" MM_editColumn = "ProductID" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "delproduct.asp" ' append the query string to the redirect URL If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If End If%><%' *** Delete Record: construct a sql delete statement and execute itIf (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql delete statement MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the delete Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End IfEnd If%><%Dim Recordsetdel__MMColParamRecordsetdel__MMColParam = "-1"If (Request.Form("ProductID") <> "") Then Recordsetdel__MMColParam = Request.Form("ProductID")End If%><%Dim RecordsetdelDim Recordsetdel_numRowsSet Recordsetdel = Server.CreateObject("ADODB.Recordset")Recordsetdel.ActiveConnection = MM_connection1_STRINGRecordsetdel.Source = "SELECT ProductID FROM Products WHERE ProductID = " + Replace(Recordsetdel__MMColParam, "'", "''") + ""Recordsetdel.CursorType = 0Recordsetdel.CursorLocation = 2Recordsetdel.LockType = 1Recordsetdel.Open()Recordsetdel_numRows = 0%><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1"><% If Not Recordsetdel.EOF Or Not Recordsetdel.BOF Then %><form name="form1" method="POST" action="<%=MM_editAction%>"> <input type="text" name="textfield"> <input type="submit" name="Submit" value="Submit"> <input type="hidden" name="MM_delete" value="form1"> <input type="hidden" name="MM_recordId" value="<%= Recordsetdel.Fields.Item("ProductID").Value %>"></form><% End If ' end Not Recordsetdel.EOF Or NOT Recordsetdel.BOF %><% If Recordsetdel.EOF And Recordsetdel.BOF Then %>No Records Found<% End If ' end Recordsetdel.EOF And Recordsetdel.BOF %></body></html><%Recordsetdel.Close()Set Recordsetdel = Nothing%>
-
-
I am trying to delete a specific colum, say ProductID = 30 from table Product_tblnow when I use server behaviour to delete, by filtering the recordset it doesn't really delete that particular ID but it goes only the next one in the row, for example:I enter 30the productID deleted is 29, or 28 or which ever productID it encounter.is there anyway to solve this please.by using filter, I use both URL and Form variable but none works, can sql solve this?please let me know
-
I am trying to delete a specific colum, say ProductID = 30 from table Product_tblnow when I use server behaviour to delete, by filtering the recordset it doesn't really delete that particular ID but it goes only the next one in the row, for example:I enter 30the productID deleted is 29, or 28 or which ever productID it encounter.is there anyway to solve this please.by using filter, I use both URL and Form variable but none works, can sql solve this?please let me know
-
well I started another page from scratch, I was told it might be for the template or some html tags, now I am having this problem, and I don't know why, but the recordset isn't empty when I test it it return a value !sorry I don't know how to wrap my codeADODB.Field error '800a0bcd' Unknown runtime error /salem/TMPm0jbk691lx.asp, line 117 the code is as follow<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!--#include file="Connections/connection1.asp" --><%' *** Edit Operations: declare variablesDim MM_editActionDim MM_abortEditDim MM_editQueryDim MM_editCmdDim MM_editConnectionDim MM_editTableDim MM_editRedirectUrlDim MM_editColumnDim MM_recordIdDim MM_fieldsStrDim MM_columnsStrDim MM_fieldsDim MM_columnsDim MM_typeArrayDim MM_formValDim MM_delimDim MM_altValDim MM_emptyValDim MM_iMM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Request.QueryStringEnd If' boolean to abort record editMM_abortEdit = false' query string to executeMM_editQuery = ""%><%' *** Delete Record: declare variablesif (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_connection1_STRING MM_editTable = "Products" MM_editColumn = "ProductID" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "Untitled-2.asp" ' append the query string to the redirect URL If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If End If%><%' *** Delete Record: construct a sql delete statement and execute itIf (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql delete statement MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the delete Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End IfEnd If%><%Dim Recordsetdel__MMColParamRecordsetdel__MMColParam = "1"If (Request.Form("ProductID") <> "") Then Recordsetdel__MMColParam = Request.Form("ProductID")End If%><%Dim RecordsetdelDim Recordsetdel_numRowsSet Recordsetdel = Server.CreateObject("ADODB.Recordset")Recordsetdel.ActiveConnection = MM_connection1_STRINGRecordsetdel.Source = "SELECT ProductID FROM Products WHERE ProductID = " + Replace(Recordsetdel__MMColParam, "'", "''") + ""Recordsetdel.CursorType = 0Recordsetdel.CursorLocation = 2Recordsetdel.LockType = 1Recordsetdel.Open()Recordsetdel_numRows = 0%><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><form name="form1" method="POST" action="<%=MM_editAction%>"> <input type="text" name="textfield"> <input type="submit" name="Submit" value="Submit"> <input type="hidden" name="MM_delete" value="form1"> <input type="hidden" name="MM_recordId" value="<%= Recordsetdel.Fields.Item("ProductID").Value %>"></form></body></html><%Recordsetdel.Close()Set Recordsetdel = Nothing%>
-
stock control
in ASP
QUOTE]Message Forwarded From salim
Message Forwarded From salimhI ALL !i WOULD BE VERY GREATFUL IF YOU COULD SHOW ME HOW TO APPLY INSERT, UPDATE AND DELETE TO SEVERAL TABLES IN MY DATABASE IN ONLY ONE EVENT, THERE IS TRIGGER IN SQL, BUT i WOULD LIKE TO USE COMMAND PROCEDURES, ANYWAY I HAVE AN EXAMPLE TO SHOW YOUI have the following tables in my access DB;tbl_Stock ( stocID Primary Key)tblProducts_in_stock ( a result of m:m relationship between tbl_stock andtbl_Product)tbl_product (productID PK)tblProduct_sold ( a result of m:m relationship between tbl_sales andtbl_Product)tbl_sales (saleID PK)I have a stock control system that I want to have under control, i.e whenproduct is sold it will be ( deleted or updated ) from tbl_stock and insertedinto tbl_sales this way the system works well.I am using dreamweaver and I use stored command procedure that have generatedthis to me:<%var Command1 = Server.CreateObject("ADODB.Command");Command1.ActiveConnection =MM_reMovies_STRING;Command1.CommandText = "INSERT INTO Product_sold ( SaleID,ProductID ) SELECT Productsold.SaleID, Productsold.ProductID FROMProduct_sold";Command1.CommandType = 1;Command1.CommandTimeout =0;Command1.Prepared = true;Command1.Execute();%> <%var Command2 = Server.CreateObject("ADODB.Command");Command2.ActiveConnection =MM_reMovies_STRING;Command2.CommandText = "DELETE Product_sold.ProductID FROMProduct_sold ";Command2.CommandType = 1;Command2.CommandTimeout =0;Command2.Prepared = true;Command2.Execute();%> this is the message I get just when I put command1 ( insert)Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] The changes you requested to the tablewere not successful because they would create duplicate values in the index,primary key, or relationship. Change the data in the field or fields thatcontain duplicate data, remove the index, or redefine the index to permitduplicate entries and try again. /salem/TMPn0fd0ydlsw.asp, line 11 it seems that I can find my way out if this, I aam trying a lot but I can't. isthere anyway that I can follow, o scrip that I can write in sql ? is there anyproblem with my talbles?thanks________________________________________________________ Thanks, -
am trying to delete a record but I have iniatially thismessage:Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ProductID = , 1567'. /salem/pages/fresh_food/TMP3rfr35u5pa.ASP, line 74 I looked at the meaning but so far I can't see that there is no reserved words I used or space, any idea?that was my first message, after consulting with many in forums, here what I aam gettingthen with some changes I had this message:Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ProductID = <font face='. /salem/TMP4fbu36742n.asp, line 74 okay, this isn't simple as that, it's not about numeric...here is my code, I have made some changes (from instructions from other people in the forum)and may be you could spot where the error is just to get it delete.i did highlight where the changes where madeDELPRODUCT.asp PAGE<%@LANGUAGE="VBSCRIPT"%>MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))If (Request.QueryString <> "") ThenMM_editAction = MM_editAction & "?" & Request.QueryStringEnd If' boolean to abort record editMM_abortEdit = false' query string to executeMM_editQuery = ""%><%' *** Delete Record: declare variablesif (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") ThenMM_editConnection = MM_connection1_STRINGMM_editTable = "Products"MM_editColumn = "ProductID"MM_recordId = "" + Request.Form("MM_recordId") + ""MM_editRedirectUrl = "delproduct.asp"' append the query string to the redirect URLIf (MM_editRedirectUrl <> "" And Request.QueryString <> "") ThenIf (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") ThenMM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryStringElseMM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryStringEnd IfEnd IfEnd If%><%' *** Delete Record: construct a sql delete statement and execute itIf (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then' create the sql delete statementMM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordIdIf (Not MM_abortEdit) Then' execute the deleteSet MM_editCmd = Server.CreateObject("ADODB.Command")MM_editCmd.ActiveConnection = MM_editConnectionMM_editCmd.CommandText = MM_editQueryMM_editCmd.ExecuteMM_editCmd.ActiveConnection.CloseIf (MM_editRedirectUrl <> "") ThenResponse.Redirect(MM_editRedirectUrl)End IfEnd IfEnd If%><%Dim delpro__MMColParamdelpro__MMColParam = "1"If (Request.Form("ProductID") <> "") Then delpro__MMColParam = Request.Form("ProductID")End If%><%Dim delproDim delpro_numRowsSet delpro = Server.CreateObject("ADODB.Recordset")delpro.ActiveConnection = MM_connection1_STRINGdelpro.Source = "SELECT ProductID FROM Products WHERE ProductID = " + Replace(delpro__MMColParam, "'", "''") + ""delpro.CursorType = 0delpro.CursorLocation = 2delpro.LockType = 1delpro.Open()delpro_numRows = 0%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Untitled Document</title>function MM_reloadPage(init) { //reloads the window if Nav4 resizedif (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true);//--></script></head><body><<%=MM_editAction%>"><table width="75%" border="1" cellpadding="2"><tr> <td>product id</td><td> <input type="text" name="textfield"></td></tr><tr> <td>*</td><td> <input type="submit" name="Submit" value="del"> </td></tr></table><input type="hidden" name="MM_delete" value="form1"><input type="hidden" name="MM_recordId" value="<%= delpro.Fields.Item("ProductID").Value %>"></form></div><div id="Layer6" style="position:absolute; left:7px; top:15px; width:756px; height:117px; z-index:6"> <table width="100%" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><tr> <td width="28%" height="102"><p align="center"><strong><font color="#009900" size="6">Top Value Supermarket</font></strong></p></td><td width="3%" bgcolor="#009900"><div align="center"></div></td><td width="3%" bgcolor="#00CC00"><div align="center"></div></td><td width="7%" bgcolor="#00FF00"><div align="center"></div></td><td width="59%" bgcolor="#00FF99"><p align="center"><strong><font color="#FF0000" size="5" face="Blackadder ITC">Value always...in your hands</font></strong></p><p align="center"><strong>| Home | Online Shopping | Site Map | Contact US | My Account | </strong></p></td></tr></table></div></body></html><%delpro.Close()Set delpro = Nothing%>this is another example from another pagedeleteproducts.ASP page<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include file="../../Connections/connection1.asp" --><%' *** Edit Operations: declare variablesDim MM_editActionDim MM_abortEditDim MM_editQueryDim MM_editCmdDim MM_editConnectionDim MM_editTableDim MM_editRedirectUrlDim MM_editColumnDim MM_recordIdDim MM_fieldsStrDim MM_columnsStrDim MM_fieldsDim MM_columnsDim MM_typeArrayDim MM_formValDim MM_delimDim MM_altValDim MM_emptyValDim MM_iMM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))If (Request.QueryString <> "") ThenMM_editAction = MM_editAction & "?" & Request.QueryStringEnd If' boolean to abort record editMM_abortEdit = false' query string to executeMM_editQuery = ""%><%' *** Delete Record: declare variablesif (CStr(Request("MM_delete")) = "DELETEPRODUCT" And CStr(Request("MM_recordId")) <> "") ThenMM_editConnection = MM_connection1_STRINGMM_editTable = "Products"MM_editColumn = "ProductID"MM_recordId = "" + Request.Form("MM_recordId") + ""MM_editRedirectUrl = "DELETEPRODUCT.ASP"' append the query string to the redirect URLIf (MM_editRedirectUrl <> "" And Request.QueryString <> "") ThenIf (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") ThenMM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryStringElseMM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryStringEnd IfEnd IfEnd If%><%' *** Delete Record: construct a sql delete statement and execute itIf (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then' create the sql delete statementMM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordIdIf (Not MM_abortEdit) Then' execute the deleteSet MM_editCmd = Server.CreateObject("ADODB.Command")MM_editCmd.ActiveConnection = MM_editConnectionMM_editCmd.CommandText = MM_editQueryResponse.Write "SQL= " & MM_editQueryResponse.End()MM_editCmd.ExecuteMM_editCmd.ActiveConnection.CloseIf (MM_editRedirectUrl <> "") ThenResponse.Redirect(MM_editRedirectUrl)End IfEnd IfEnd If%><%Dim RecordsetdeleteDim Recordsetdelete_numRowsSet Recordsetdelete = Server.CreateObject("ADODB.Recordset")Recordsetdelete.ActiveConnection = MM_connection1_STRINGRecordsetdelete.Source = "SELECT ProductID FROM Products"Recordsetdelete.CursorType = 0Recordsetdelete.CursorLocation = 2Recordsetdelete.LockType = 1Recordsetdelete.Open()Recordsetdelete_numRows = 0%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script language="JavaScript" type="text/JavaScript"><!--function MM_reloadPage(init) { //reloads the window if Nav4 resizedif (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true);//--></script></head><td width="49%"> <input name="ProductID" type="text" id="ProductID"></td></tr></table><p align="center"> <input type="submit" name="Submit" value="DELETE PRODUCT"></p><input type="hidden" name="MM_recordId"><input type="hidden" name="MM_delete" value="DELETEPRODUCT"><input type="hidden" name="MM_recordId" value="<%= Replace (Recordsetdelete.Fields.Item("ProductID").Value , ",", "")%>"></form></div></body></html><%Recordsetdelete.Close()Set Recordsetdelete = Nothing%>NOTE I DID GET RID OF SOME TAGS JUST TO GET SPACE TO BE ABBLE TO SEND THIS MESSAGE
delete
in ASP
Posted