Jump to content

jojay

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by jojay

  1. jojay

    like operator

    cname is the field name in the database but I dont want to give any particular letters such '%ja%' because there can be numerous combination in the field "cname".Now, when I use the above code, it result is:select * from page1 where cname like '%cname%' or what is the best way to search a field name? I have done in the paste and dont remember now.
  2. jojay

    like operator

    Hi, Can someone please help with the following syntax: sql1 = "Select Cname from page1 where Cname like '%Cname%'" Above code isnt working. Cname is a text field and would like to know the syntax for the above sql statement using Like. Thanks.
  3. jojay

    refresh the page

    Thank you. I fixed the issue. Thank you again for your help.
  4. No problem. I fixed it and it works perfectly. Thankyou. And thanks for explaining the difference.
  5. Hi,I finally got the querystring working. According to your code, adOpenStatic, adLockoptimistic, was not getting the values from adovb.inc in my case, so I included the const adOpenStatic as 3 and adLockoptimistic as 3 and adUseClient as 3 as declaration and then used them in rs.open, it worked. What is the difference between this:rs.open sql1,con,3,3 and this: const adUseClient = 3const adOpenStatic = 3const adLockOptimisitic = 3set connset rsrs.open sql1, adOpenStatic, adLockOptimistic Because in my opinion, in the first case, using the const directly without declaring. In the second case, it is declaring and using them. Please correct if I am wrong. Would like to know the difference? My next question, now the querystring is working but still not able to bring all my data to the resultpage.asp. Should I open the connection and using rs, bring the data from the database or just use response.write(fieldname) and pass the data. Confused.
  6. Yahweh,I tried and it didnt work. I have a copy of it in my folder but I am assuming that it should be used only when using heavy coding......anyway, that didnt help.here is my error:ADODB.Recordset error '800a0bb9'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. it points to line 39 which is :rs.CursorLocation = AdUseClient If I comment that line, then the error is going to: rs.Open sql1, con, adOpenStatic, adLockOptimisitic Now, the error is showing up in result.asp and data is not inserting to the database.I really dont know what is causing my problem not passing the value.
  7. I used the above code and I modified some places like the adopenstatic and adlockoptimisitc becoz it is not letting me update and getting an error message such as "Arguement are not same or in conflict to each other"...The above code works fine sending the info into the database but at resultpage.asp, it is not passing still.
  8. Can someone tell how to pass a value from one page to another?I am trying to populate the form in form.asp and send those info to result.asp, dump into the database and response.write that info to the third page which is resultpage.asp. I am able to populate and send to database and it goes to resultpage.asp but it is not response.writing the info.result.asp request.form fieldnamesconnection and recordset stringrs.open "Insert into table...."rs.open "Select Top 1 CID from cform Order BY CID Asc"new_id = rs.fields.item("CID").valuers.closecon.closeand set both = nothingresponse.redirect("resultpage.asp?CID = " & New_id) resultpage.asp CID = request.querystring("new_id")request.form formfieldsresponse.write formfields My question is, should I have to create <form></form> and input fields to pass the values to the resultpage.asp. Anyway, I dont want to give a submit button in result.asp to pass the value to resultpage.asp. Any suggestins? Thanks.
  9. jojay

    refresh the page

    I am getting an error when using the select statement:rs.open "Select Max(Cid) from Cform" ' getting error when using Max(id) as CID error msg:ADODB.Fields error '800a0cc1' Item cannot be found in the collection corresponding to the requested name or ordinal. It looks like it is not recogizing Max(Cid).
  10. jojay

    refresh the page

    I tried like the above code and also tried like the one below:Set con = Server.Createobject("ADODB.Connection")con.open "dsn=Candidate"rs.Activeconnection = conrs.open "Insert into Cform (Cssn, Cjobno) Values("&Cssn&","&Cjobno&")"rs.open "Select Max(ID) as ID from Cform" Getting this error for both:Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Mc@gmail.com'. ' it is email input type = text
  11. jojay

    refresh the page

    Exactly. First I also had the same question but it is not allowing me to send the info to the databse and moreover getting an error such as "Item not found in ......" and if I do a select statement with all the field names it is fine. Anyway, I tried your way:Here is the problem. I am getting an error.ADODB.Recordset error '800a0e7d' The connection cannot be used to perform this operation. It is either closed or invalid in this context. result.asp, line 38 ' it is pointing to the insert statement. Here is my code: Set con = Server.createobject("Adodb.Connection")con.open"dsn=Candidate"Set rs = Server.createobject("Adodb.Recordset")rs.open "Insert into Cform (Cssn, Cjobno Values("&Cssn&","&Cjobno&"))"rs.open ("Select Max(ID) from Cform"), con, 3, 3
  12. jojay

    refresh the page

    rs.addnewrs.field1rs.field2rs.update is another way of inserting data to the database rather update kind. I am more comfortable using addnew method becoz there is no much extra strings to add and it is clean especially sending data to the database. Anyway, will try you way of insert method.
  13. jojay

    refresh the page

    I am not inserting any data in the last level, only displaying what I just inserted in result.asp.Scenerio:(I am creating a form to input data to send to database. form.asp takes the input of data and sends to result.asp and that page inserts the data and creates a variable to pass to the next page which is resultpage.asp and display the info).form.aspformfields....submit button-------------------------result.asprequest.form formfieldsconnectioninsert into the databasecreate variable for id to store the value of id from this page to pass to the next pagerecordset and connection closeresponse.redirect to resultpage.asp-------------------------------resultpage.asprequest.querystring idformfields display And the code for the last part is: result.aspnew_id = rs.fields.item("ID").valueresultpage.aspID = request.querystring("new_id") I guess I have to create another connection and recordset to retrieve the info from database. will try.
  14. The code looks good but it looks like redirect in javascript. I might be wrong.
  15. Here are some links:http://www.w3schools.com/ado/prop_rs_locktype.asphttp://www.connectionstrings.com/adoenumerations.asp
  16. jojay

    refresh the page

    I fixed the sql issue now I have problem passing the value of New_id to the next page, that is resultpage.asp. For some reason, the value is not passing. When I look at my browser URL it shows as:http://mydomain/resultpage.asp?ID=Code for the above:rs.addnewrs.field1rs.field2rs.updatenew_id = rs.fields.item("ID").value%><%rs.closeSet rs=nothingcon.closeSet con=nothing%>br /><br /><%response.redirect("resultpage.asp?ID=" & new_id) on the resultpage.asp: ID = request.querystring("new_id")
  17. jojay

    refresh the page

    Sorry and thank you for your help. I didnt understand in the first place regarding the connection and recordset object. I am working on the code to refresh the page without getting the data to the database. And your suggestion seemed good and so I started working in your direction. Now, it seems good but getting error when using the sql statement. Here is my code:result.asp<%Set con = Server.createobject("Adodb.Connection")con.open"dsn=Candidate"Set rs = Server.createobject("Adodb.Recordset")Set rs = con.execute ("Select Max(CID) from Cform")rs.AddNewrs("Cssn") = Cssnrs("Cjobno") = Cjobnors.updatenew_id = rs.fields.item("CID").value%><%rs.closeSet rs=nothingcon.closeSet con=nothing%>response.redirect("resultpage.asp?Cid=" + new_id) So far so good. But I am not able to get to the sql statement your way. Any help would be greatful. Thanks again.
  18. jojay

    refresh the page

    I am having problem with this code. When I use as this: rs.open "Select Max(ID) as myid from cform", con, 3, 3 It is not recognizing the other fields in the database and I am getting an error such as "Item not to be found for the requested........."So, I changed the Select statement using all the fields such as: "Select Max(CID), Cssn, ......from cform" Now, I am getting this error message:Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] You tried to execute a query that does not include the specified expression 'Cssn' as part of an aggregate function. I understand since we are using the Max function, it is showing up that error. What is the round about to do this? Thanks for the help.
  19. jojay

    refresh the page

    I am still having problems with my code. I am getting the following error:Microsoft OLE DB Provider for ODBC Drivers error '80040e10' [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. I have few questions:Why do you have use : con.open "Select Max(ID) as myid from cform" should it be : rs.open "Select Max(ID) as myid from cform", con, 3, 3 because I am already opening the con.open "dsn=candidate"the error points at: new_id = con.fields.item("myid").value after the above code, giving rs.addnew.....so on...
  20. jojay

    refresh the page

    I just want to make sure if I am doing it right: here is my modified code:Form.aspID field as hiddenother formfields....Submit button------result.aspformfields = request.form("formfields")Set con = server.createobject("ADODB.Connection")con.open "dsn=mydsn"Set rs = server.createobject("ADODB.Recordset")rs.open "select * from tablename where 0=1",3,3addnew method to insert to databasers.updatecon.open("Select Max(id) as myid from tablename");new_id = con.fields.item("id").value [COLOR=red]'I dont understand this line...what is con.fields.item...is the fieldname from the table...[/COLOR]connection.closerecordset.closeresponse.redirect("resultpage.asp?id=" + new_id);-------resultpage.aspCID = Request.querystring("CID")response.write("formfields")Print command to print. Thank you for your help.
  21. jojay

    refresh the page

    I understand what it means. How will I get the ID from previous page. This is my scenerio:Form.aspID field as hiddenother formfields....Submit button------result.aspformfields = request.form("formfields")Set connection..Set Recordset...addnew method to insert to database<input type="hidden" name="CID" value="<%=rs("CID")%>">connection.closerecordset.closeresponse.redirect("resultpage.asp")-------resultpage.aspCID = Request.Form("CID")response.write("formfields")Print command to print. Now, since I have given autonumber as datatype for CID, each time when I sent the data to the database, the autonumber increments. How will I get the CID from the database to show up in resultpage.asp. Should I open again the connection and retreive the CID? Please help.
  22. jojay

    refresh the page

    Hi,I tried to work this around and I am almost there but with little problem. What I did is, is to keep the form.asp and direct the result to result.asp. In result.asp, i am giving the response.redirect to resultpage.asp and also included the <input type="hidden" name="ID">. In resultpage.asp, i am trying to get the results from form.asp through the hidden ID. In resultpage.asp, the codes are: ID = Request.form("ID")<input type="hidden" name="ID" value="<%response.write("ID")%>">then table with form fields as response.write(request.form("fieldname")) As you can see, I havent given connection to the database since I am just extracting the result to this page through response.write. But I am getting an error such as below:"object required".what does it mean? Do I need connection in this page? thanks.
  23. jojay

    refresh the page

    Thank you very much. I wouldnt have had a better explanation. But one thing I dont understand - <get id for new data>. Is it like this: <input type="hidden" name="id"> to redirect to same page or to different page?
  24. jojay

    refresh the page

    Sounds good. But can you tell at which point will I response.redirect the result of ID from process.asp to result.asp. That is, should it come somewhere in the beginning or at end.
  25. jojay

    refresh the page

    That is how it is now.I have form.asp and submit. That information is going to resultpage.asp in which the processing is taking place using Addnew method. But I dont have response.direct in the result page to the same page. If i do response.redirect("resultpage.asp"), will the content remain in the page? Because on the resultpage.asp, I am also response.write all the info which was entered on form.asp, so if I want to print the info, can use the print command.
×
×
  • Create New...