Jump to content

evr72

Members
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About evr72

  • Rank
    Newbie
  • Birthday 01/31/1972

Profile Information

  • Location
    IL
  1. Hello, I am new at Javascript and trying to make this work. I have a button that I have called "Back To Main Page"I have the followin script onclick="if (confirm('Would You Like To Save Your Work?'))submit(); return false;" This works and it asks the user if he/she would like to save ther work if they click ok it saves if cancel noting happens up to this point is ok, but I would like to redirect the user to another page if the user clicks ok I have tried a few things but nothing seems to work. any help is much appreciated. thanks!!
  2. evr72

    Duplicate Recods

    ok, I added the parentesis strSQL1 = "SELECT questions.* FROM questions WHERE itm NOT IN (SELECT itm FROM answers WHERE username='" & Request.Form("txtUsername")) & "'" but still getting an error Error Type:Microsoft VBScript compilation (0x800A0401)Expected end of statement/questions/project/questionstry1.asp, line 31, column 134strSQL1 = "SELECT questions.* FROM questions WHERE itm NOT IN (SELECT itm FROM answers WHERE username='" & Request.Form("txtUsername")) & "'"-------------------------------------------------------------------------------------------------------------------------------------^
  3. evr72

    Duplicate Recods

    sorry, got to excitedthe erro is still the same as before. I was trying something out and accidentally took the S from Selec out Error Type:Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)[Microsoft][ODBC Microsoft Access Driver] Missing ), ], or Item in query expression 'itm NOT IN (SELECT itm FROM answers WHERE username='''./questions/project/questionstry1.asp, line 35[/code
  4. evr72

    Duplicate Recods

    ok this is odd,I just tried it again and now this is the error I get Error Type:Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)[Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'./questions/project/questionstry1.asp, line 36[/code
  5. evr72

    Duplicate Recods

    Yes, the questions table has itm (question id) and the answers table has itm (question id)
  6. evr72

    Duplicate Recods

    I took those out and now the error is Error Type:Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)[Microsoft][ODBC Microsoft Access Driver] Missing ), ], or Item in query expression 'itm NOT IN (SELECT itm FROM answers WHERE username='''./questions/project/questionstry1.asp, line 35 this is line 35 rs1Guestbook.Open strSQL1, adoCon1
  7. evr72

    Duplicate Recods

    ok so I tried <%Username = Request.Form("txtUsername") Password = Request.Form("txtPassword")'Dimension variablesDim adoCon1 'Holds the Database Connection ObjectDim rs1Guestbook 'Holds the recordset for the record to be updatedDim strSQL1 'Holds the SQL query for the database'Create an ADO connection odjectSet adoCon1 = Server.CreateObject("ADODB.Connection")'Set an active connection to the Connection object using a DSN-less connectionadoCon1.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("qa.mdb")'Set an active connection to the Connection object using DSN connection'adoCon.Open "DSN=guestbook"'Create an ADO recordset objectSet rs1Guestbook = Server.CreateObject("ADODB.Recordset")'Initialise the strSQL variable with an SQL statement to query the databasestrSQL1 ="SELECT * FROM questions WHERE itm NOT IN (SELECT itm FROM answers WHERE username='" & Session("Username")&"'",adoCon,1 'Open the recordset with the SQL query rs1Guestbook.Open strSQL1, adoCon1%> and get the following error Error Type:Microsoft VBScript compilation (0x800A0401)Expected end of statement/questions/project/questionstry1.asp, line 33, column 119strSQL1 ="SELECT * FROM questions WHERE itm NOT IN (SELECT itm FROM answers WHERE username='" & Session("Username")&"'",adoCon,1----------------------------------------------------------------------------------------------------------------------^
  8. evr72

    Duplicate Recods

    I appreciate the guidance. I will give it a try Thank youi!!!
  9. evr72

    Duplicate Recods

    I already have a field with the question id in my questions table and my answers table, the field is "itm". justsomeguy I am not sure how to write this part.I've tried to join my questions table and answers table but that did not work very well.
  10. evr72

    Duplicate Recods

    that is exactly what I am trying to do but not too sure how to go about it. Thanks!!!!
  11. evr72

    Duplicate Recods

    Sorry, I should have explained a bit better.The form can be updated with new questions at any time. The users can log in at any time to answer the questions. What I was trying to do is to redirect the user to a new page if he/she has already answer the questions.I have 3 tablesUsers useridusernamecompanyeamailQuestionsquestionidquestionquestionpart2questionpart3Answersuseridusernamecompanynameanswer1answer2answer3 Function IsInteger(Data) If Trim(Data) = "" Then IsInteger = False Else IsInteger = IsNumeric(Data & ".0e0") End IfEnd Function'declare your variablesDim itm, userid, username, company, iDim sConnString, connection, sSQL'Receiving values from Form, assign the values entered to variablesitm = Split(Request.Form("itm"),",")userid = Split(Request.Form("userid"),",")username = Split(Request.Form("username"),",")company = Split(Request.Form("company"),",")'define the connection string, specify database'driver and the location of databasesConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _"Data Source=" & Server.MapPath("qa.mdb")'create an ADO connection objectSet connection = Server.CreateObject("ADODB.Connection")'Open the connection to the databaseconnection.Open(sConnString)sSQL = "INSERT into signed (userid) values ('" & _trim(userid(i)) & "') " connection.execute(sSQL)For i = lBound(userid) to ubound(userid) 'declare SQL statement that will query the database sSQL = "INSERT into answers (itm, userid, username, company) values ('" & _trim(itm(i)) & "', '" & trim(userid(i)) & "', '" & trim(username(i)) & "', '" & trim(company(i)) & "')" connection.execute(sSQL)Next'execute the SQL' connection.execute(sSQL) don't need this line anymore'Done. Close the connection objectconnection.CloseSet connection = NothingResponse.Redirect "edit/answers_list.asp"%> This populates the answers table. This is the table that might get the duplicate records and I would like to prevent that from happening
  12. evr72

    Duplicate Recods

    Hello, I have a form where users log in and answer different quesitons. The form gets updated with new questions. I would like to prevent the users from submiting the same questions twice. but not sure how to go about this. I am a bit new to programming and asp. Any help is greatly appreciated. Thanks!!!
  13. Hello, I am new to the wonderful world of programming. I have been working a bit with some JavaScripts and ASP pages. I have a script that checks the value of a drop down field and tells the user if another field is required or not, this works great, but when I change the dropdown box to a regular field the script does not work and not sure why, I was wondering if anybody could give me some advice or point me in the right direcction. Here is the script function OnPageLoadEdit(pageid){var tName = 'answers';var ctrlkeycontrol = Runner.controls.ControlManager.getAt(tName, pageid, 'keycontrol');var ctrlresp = Runner.controls.ControlManager.getAt(tName, pageid,'resp');var ctrlexplain= Runner.controls.ControlManager.getAt(tName, pageid,'explain');var ctrliscontroldocumented = Runner.controls.ControlManager.getAt(tName, pageid,'iscontroldocumented');var ctrlnarrativeofcontrol = Runner.controls.ControlManager.getAt(tName, pageid,'narrativeofcontrol');var ctrlfrequency = Runner.controls.ControlManager.getAt(tName, pageid,'frequency');var ctrlpersonresponsable = Runner.controls.ControlManager.getAt(tName, pageid,'personresponsable');var ctrlmanualorautomated = Runner.controls.ControlManager.getAt(tName, pageid,'manualorautomated');ctrlkeycontrol.on('change', function(e){ if (this.getValue() == 'X'){ ctrlresp.addValidation("IsRequired"); ctrlexplain.addValidation("IsRequired");ctrliscontroldocumented.addValidation("IsRequired"); ctrlnarrativeofcontrol.addValidation("IsRequired"); ctrlfrequency.addValidation("IsRequired"); ctrlpersonresponsable.addValidation("IsRequired"); ctrlmanualorautomated.addValidation("IsRequired"); }});} I have tried to change the ctrlkeycontrol.on('change', function but no luck
×
×
  • Create New...