aspnetguy Posted February 7, 2006 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. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 7, 2006 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. Link to comment Share on other sites More sharing options...
choobakka Posted February 7, 2006 Author 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. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 7, 2006 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 Link to comment Share on other sites More sharing options...
choobakka Posted February 7, 2006 Author 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? Link to comment Share on other sites More sharing options...
aspnetguy Posted February 7, 2006 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. Link to comment Share on other sites More sharing options...
choobakka Posted February 7, 2006 Author 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. Link to comment Share on other sites More sharing options...
netcracker Posted February 7, 2006 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 Link to comment Share on other sites More sharing options...
choobakka Posted February 7, 2006 Author Share Posted February 7, 2006 same again Link to comment Share on other sites More sharing options...
netcracker Posted February 7, 2006 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 Link to comment Share on other sites More sharing options...
choobakka Posted February 7, 2006 Author Share Posted February 7, 2006 same again im afraid Link to comment Share on other sites More sharing options...
netcracker Posted February 8, 2006 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 ! Link to comment Share on other sites More sharing options...
choobakka Posted February 8, 2006 Author Share Posted February 8, 2006 sorry im a lil confused. can u talk me through exactly what i need to do step by step. Link to comment Share on other sites More sharing options...
netcracker Posted February 8, 2006 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 ! Link to comment Share on other sites More sharing options...
choobakka Posted February 8, 2006 Author 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 Link to comment Share on other sites More sharing options...
choobakka Posted February 8, 2006 Author 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! Link to comment Share on other sites More sharing options...
aspnetguy Posted February 9, 2006 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. Link to comment Share on other sites More sharing options...
choobakka Posted February 9, 2006 Author Share Posted February 9, 2006 cool. its no problem. im grateful for your help. thanks Link to comment Share on other sites More sharing options...
aspnetguy Posted February 9, 2006 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 Link to comment Share on other sites More sharing options...
choobakka Posted February 9, 2006 Author Share Posted February 9, 2006 sorry i cant help u there im afraid! Link to comment Share on other sites More sharing options...
choobakka Posted February 9, 2006 Author 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? Link to comment Share on other sites More sharing options...
aspnetguy Posted February 10, 2006 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??? Link to comment Share on other sites More sharing options...
choobakka Posted February 10, 2006 Author Share Posted February 10, 2006 im trying to update an existing record. Link to comment Share on other sites More sharing options...
choobakka Posted February 13, 2006 Author Share Posted February 13, 2006 any developments? Link to comment Share on other sites More sharing options...
netcracker Posted February 14, 2006 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") & "'"... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now