aspnetguy 30 Posted February 7, 2006 Report Share Posted February 7, 2006 same thing again :)same thing about not being able to submit date and no change in database<{POST_SNAPBACK}> The only thing it said wasSubmitting records has been disabled from this demothats it??? If you are clicking the save button and getting this result (and using hte exact code provided) then your page is not getting the value of the button you are clicking. Quote Link to post Share on other sites
aspnetguy 30 Posted February 7, 2006 Report Share Posted February 7, 2006 I just noticed an error in the SQL statement sql=sql & "Telephone1='" & Request.Form("Telephone1") & "'," sql=sql & "Telephone2='" & Request.Form("Telephone2") & "'," <---error here WHERE tblCustomer.[CustomerID]=" & CustomerID " Remove the comma (,) after the Request.Form("Telephone2") and add a space sql=sql & "Telephone1='" & Request.Form("Telephone1") & "'," sql=sql & "Telephone2='" & Request.Form("Telephone2") & "' " WHERE tblCustomer.[CustomerID]=" & CustomerID " since your code has onerror resume next this means if an error occurs it will continue anyway...so what was probably happening was this error in the sql but hte code just continued on.Try this new sql and see if that works. Quote Link to post Share on other sites
choobakka 0 Posted February 7, 2006 Author Report Share Posted February 7, 2006 yes thats it. thats the only message (and action) thats happening."your page is not getting the value of the button you are clicking."please explain. Quote Link to post Share on other sites
aspnetguy 30 Posted February 7, 2006 Report Share Posted February 7, 2006 yes thats it. thats the only message (and action) thats happening."your page is not getting the value of the button you are clicking."please explain.<{POST_SNAPBACK}> ignore that and look at the next post I made...I am pretty sure that has been the issue all along Quote Link to post Share on other sites
choobakka 0 Posted February 7, 2006 Author Report Share Posted February 7, 2006 same result im afraid. would you like to see the other ASP pages or is it only this page which is the problem? Quote Link to post Share on other sites
aspnetguy 30 Posted February 7, 2006 Report Share Posted February 7, 2006 If you posted the full code for this page and the page with the submit buttons I will try and run some tests. This is very bizarre behavior...I will have to see it for myself. Quote Link to post Share on other sites
choobakka 0 Posted February 7, 2006 Author Report Share Posted February 7, 2006 this is the code for the ASP page (view.asp) which extracts all of the data from the table within the database:<%option explicit%><html><head><title>List Database Table</title></head><body><%dim conn,rs,xset conn=Server.CreateObject("ADODB.Connection") conn.provider="Microsoft.Jet.OLEDB.4.0"conn.open(server.mappath("disso1.mdb"))set rs=Server.CreateObject("ADODB.Recordset")rs.open "SELECT * FROM tblCustomer",conn%><h2>List Database Table</h2><p>Click on a button to modify a record.</p><table border="1" width="100%"><tr bgcolor="#b0c4de"><%for each x in rs.Fields response.write("<th>" & ucase(x.name) & "</th>")next%></tr><%do until rs.EOF%><tr bgcolor="#f0f0f0"><form method="post" action="demo_db_edit.asp" target="_blank"><%for each x in rs.Fields if x.name="CustomerID" then%> <td><input type="submit" name="CustomerID" value="<%=x.value%>"></td> <%else%> <td><%Response.Write(x.value)%> </td> <%end ifnext%></form><%rs.MoveNext%></tr><%looprs.closeset rs=nothingconn.closeset conn=nothing%></table></body></html>view.asp also creates buttons for the unique identifiers(customerid) for each record. if i click on any of these buttons i am presented with demo_db_edit.asp:<%CustomerID=Request.Form("CustomerID")if CustomerID="" then response.endset conn=Server.CreateObject("ADODB.Connection") conn.provider="Microsoft.Jet.OLEDB.4.0"conn.open(server.mappath("disso1.mdb"))set rs = Server.CreateObject("ADODB.Recordset")rs.Open "Select * from tblCustomer where tblCustomer.[CustomerID]=" & CustomerID , conn%><html><head><title>Edit DataBase Table</title></head><body><h2>Edit Database Table</h2><form method="post" action="demo_db_submit.asp" target="_blank"><input name="CustomerID" type="hidden" value=<%=CustomerID%>><table bgcolor="#b0c4de"><%for each x in rs.Fields if x.name <> "no" and x.name <> "dateadded" then%> <tr> <td><%=x.name%> </td> <td><input name="<%=x.name%>" value="<%=x.value%>" size="20"></td> <%end ifnextrs.closeconn.close%></tr></table><br /><input type="submit" name="action" value="Save"><input type="submit" name="action" value="Delete"></form></body></html>this page allows me to edit the data for the selected record. i am also presented with a SAVE button and a DELETE button. each of those buttons should either delete or save the data from/into the database. this is done via demo_db_submit.asp:<html><head><title>Submit DataBase</title></head><body><h2>Submit to Database</h2><%on error resume nextset conn=Server.CreateObject("ADODB.Connection") conn.provider="Microsoft.Jet.OLEDB.4.0"conn.open(server.mappath("disso1.mdb"))if Request.form("action")="Save" then CustomerID=Request.Form("CustomerID") sql="UPDATE tblCustomer SET CustomerID="' & Request.Form("CustomerID") & "'," sql=sql & "Last_Name='" & Request.Form("Last_Name") & "'," sql=sql & "First_Name='" & Request.Form("First_Name") & "'," sql=sql & "Address1='" & Request.Form("Address1") & "'," sql=sql & "Address2='" & Request.Form("Address2") & "'," sql=sql & "Address3='" & Request.Form("Address3") & "'," sql=sql & "Post_Code='" & Request.Form("Post_Code") & "'," sql=sql & "Telephone1='" & Request.Form("Telephone1") & "'," sql=sql & "Telephone2='" & Request.Form("Telephone2") & "' " WHERE tblCustomer.[CustomerID]=" & CustomerID "' Response.Write(sql)' Response.Write(" yuppy, we did it! ")' else ' Response.Write("Record number " & CustomerID & " was updated.")' end if Response.Write("Submitting records has been disabled from this demo")end ifif Request.Form("action")="Delete" then CustomerID=Request.Form("CustomerID")' conn.Execute "DELETE FROM tblCustomer WHERE tblCustomer.[CustomerID]=" & CustomerID, Recordsaffected' if err <> 0 then' Response.Write("You do not have permission to delete a record from this database!")' else ' Response.Write("Record number " & no & " was deleted.")' end if Response.Write("Deleting records has been disabled from this demo")end ifconn.close%></body></html>however, when i click on either the SAVE or DELETE button, i am presented with the message saying that i am not able to submit data etc and there is no action taken with regard to the database. Quote Link to post Share on other sites
netcracker 1 Posted February 7, 2006 Report Share Posted February 7, 2006 if the fields "telephone1" and so on are NUMERIC then remove the ' character: sql=sql & "Telephone1= " & Request.Form("Telephone1") & ","is this a mind-buthering post or what ?! come on guys, what's wrong with this code?!?! let's make a BRAINSTORM Quote Link to post Share on other sites
choobakka 0 Posted February 7, 2006 Author Report Share Posted February 7, 2006 same again Quote Link to post Share on other sites
netcracker 1 Posted February 7, 2006 Report Share Posted February 7, 2006 try using this liners.Open "Select * from tblCustomer where tblCustomer.[CustomerID]=" & CustomerID , connlike thisrs.Open "Select * from tblCustomer where CustomerID = " & CustomerID & "", connI'm guessing now, although it does look a bit suspect Quote Link to post Share on other sites
choobakka 0 Posted February 7, 2006 Author Report Share Posted February 7, 2006 same again im afraid Quote Link to post Share on other sites
netcracker 1 Posted February 8, 2006 Report Share Posted February 8, 2006 1. is the DB readonly; do Eeryone group has read/write permissons ?!2. use response.write command to see what data is being sent from the form and thoroughly check it !3. set ALL fields in the table to be TEXT, allow them to be empty and not required! once you've done that, use the ' character in the sql INSERT INTO/UPDATE statementgive it a shot ! Quote Link to post Share on other sites
choobakka 0 Posted February 8, 2006 Author Report Share Posted February 8, 2006 sorry im a lil confused. can u talk me through exactly what i need to do step by step. Quote Link to post Share on other sites
netcracker 1 Posted February 8, 2006 Report Share Posted February 8, 2006 In one of my earlier posts, i have instruced you on how to alow the DB to accept changes. It is a posibility that your DB is ReadOnly or the security group "Everyone" doesn't have the wright to make changes.I thought you've already checked that ! Quote Link to post Share on other sites
choobakka 0 Posted February 8, 2006 Author Report Share Posted February 8, 2006 yeah i have checked that. the DB is not readonly and the folder which contains the DB and the asp files has the 'everyone' group with full access Quote Link to post Share on other sites
choobakka 0 Posted February 8, 2006 Author Report Share Posted February 8, 2006 ASPNETGUY have u managed to run those tests?maybe i should change the IF ELSE statements starting at where the SQL statements begin! Quote Link to post Share on other sites
aspnetguy 30 Posted February 9, 2006 Report Share Posted February 9, 2006 ASPNETGUY have u managed to run those tests?maybe i should change the IF ELSE statements starting at where the SQL statements begin!<{POST_SNAPBACK}> not yet I have been very busy...I am at work most days when posting to this forum so I have to wait for breaks...lolI hope to get it done today. Sorry for the wait. Quote Link to post Share on other sites
choobakka 0 Posted February 9, 2006 Author Report Share Posted February 9, 2006 cool. its no problem. im grateful for your help. thanks Quote Link to post Share on other sites
aspnetguy 30 Posted February 9, 2006 Report Share Posted February 9, 2006 I am having trouble getting hte asp pages to run...I have ASP.Net installed...I don't know if that is interferring or not. I am frustrated Quote Link to post Share on other sites
choobakka 0 Posted February 9, 2006 Author Report Share Posted February 9, 2006 sorry i cant help u there im afraid! Quote Link to post Share on other sites
choobakka 0 Posted February 9, 2006 Author Report Share Posted February 9, 2006 do you think it is because im am missing an INSERT command in the SQL? if so where would i put the INSERT command and what would it replace? Quote Link to post Share on other sites
aspnetguy 30 Posted February 10, 2006 Report Share Posted February 10, 2006 INSERT is only used to add new records to the database...are you trying to add a new record or update an existing one??? Quote Link to post Share on other sites
choobakka 0 Posted February 10, 2006 Author Report Share Posted February 10, 2006 im trying to update an existing record. Quote Link to post Share on other sites
choobakka 0 Posted February 13, 2006 Author Report Share Posted February 13, 2006 any developments? Quote Link to post Share on other sites
netcracker 1 Posted February 14, 2006 Report Share Posted February 14, 2006 remove the last << , >> comma: sql="UPDATE tblCustomer SET CustomerID="' & Request.Form("CustomerID") & "'," sql=sql & "Last_Name='" & Request.Form("Last_Name") & "',"sql=sql & "First_Name='" & Request.Form("First_Name") & "',"sql=sql & "Address1='" & Request.Form("Address1") & "',"sql=sql & "Address2='" & Request.Form("Address2") & "',"sql=sql & "Address3='" & Request.Form("Address3") & "',"sql=sql & "Post_Code='" & Request.Form("Post_Code") & "',"sql=sql & "Telephone1='" & Request.Form("Telephone1") & "',"sql=sql & "Telephone2='" & Request.Form("Telephone2") & "',"WHERE tblCustomer.[CustomerID]=" & CustomerID " ..."Telephone2='" & Request.Form("Telephone2") & "'"... Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.