Jump to content

redsun

Members
  • Posts

    17
  • Joined

  • Last visited

redsun's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. redsun

    Update Record Set

    Uhm, there's still some error… and no concrete error code is displayed.It seems to me that you use Internet Explorer and I guess that you have 'Display detailed error messages' option ON so you do not see the exact error message sent from IIS. So you can't go to concrete line number in your code and repair the error (in fact IIS debbuger shows line number where's the error, but IE could hide this error from you).You can use Firefox or Opera to access your page or you can turn this option OFF in IE (Tools —> Internet Settings —> Details (last fold) —> (node called) Browsing —> Display detailed error messages —> OFF). Reload your page. Then post your error msg.(Sorry if the there are a little different exact names in Tools menu, I have non-english version of IE.)Thanks!
  2. There's no other way how to do that than adding one extra option with blank value and blank (or some dummy) text.If I adjust your own code, it should look like:<select name="pages"><option selected></option><option value="home">Home</option><option value="about">About</option><option value="services">Services</option><option value="mediacredits">Media Credits</option><option value="testimonials">Testimonials</option><option value="links">Links</option></select> I just added one option with no value and no text in it (maybe you would like to write there "Please select" or something) and assigned it as SELECTED. This will cause that this option will be selected initially - it's cross-browser.So this code will work the same way (moved the blank to the end): <select name="pages"><option value="home">Home</option><option value="about">About</option><option value="services">Services</option><option value="mediacredits">Media Credits</option><option value="testimonials">Testimonials</option><option value="links">Links</option><option selected></option></select> Redsun
  3. Try to run this: SELECT now() AS "current time"SELECT now()-30000 AS "current time minus 3 hours" See the difference? I hope so ;o)
  4. redsun

    Update Record Set

    You should completely remove these parts of code (some of them are irrelevant because they are used in recordsets, but you are executing INSERT command; some are not present in the code bellow): 'Dimension variablesDim adoCon 'Holds the Database Connection ObjectDim rsAddComments 'Holds the recordset for the new record to be addedDim strSQL 'Holds the SQL query to query the database and 'Write the updated recordset to the databasersAddComments.Update'Reset server objectsrsAddComments.CloseSet rsAddComments = NothingSet adoCon = Nothing Post your error message and assing error line number too please, it could containt some useful information.Also make sure that the values posted in your form fit to your DB columns (for example adding TEXT value into INT column or something like this).Redsun
  5. Did you tryed the query? There is "NOT LIKE" which will return the department names NOT selling "Geo positioning system".
  6. redsun

    Update Record Set

    I suggest you to use INSERT command instead of adNew in your SQL. AdNew doesn't work in many cases, may cause problems etc. ...Set rsAddComments = Server.CreateObject ("ADODB.Command") rsAddComments.ActiveConnection = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb") rsAddComments.CommandText = "INSERT INTO tblComments (Name, Comments) VALUES ('" & Request.Form("name") & "', '" & Request.Form("comments") & "')" rsAddComments.CommandType = 1 rsAddComments.CommandTimeout = 0 rsAddComments.Prepared = true rsAddComments.Execute()... Try it this way, I hope this will work well for you.Redsun
  7. You can take off any value you need, for example: (NOW() - 20).The number '20' depends on you database field data format (DATETIME, DATE, TIMESTAMP, TIME).
  8. redsun

    Is it possible?

    aquatsr's code is running third query after second and second after first…If you want to run 'query_rs_industry' only if user submitted form data that have to be loaded from tbl_industry or run query 'query_rs_productcategory' only if user submitted form data that have to be loaded from tbl_productcat etc., then you can specify your criteria in If-Then-Else statement.For example (change field_name to your one): If ($_POST["field_name"] == "industry")mysql_select_db($database_conn_dj, $conn_dj);$query_rs_industry = "SELECT industry_id, industry_name FROM tbl_industry ORDER BY industry_name ASC";$rs_industry = mysql_query($query_rs_industry, $conn_dj) or die(mysql_error());$row_rs_industry = mysql_fetch_assoc($rs_industry);$totalRows_rs_industry = mysql_num_rows($rs_industry);ElseIf ($_POST["field_name"] == "productcategory")mysql_select_db($database_conn_dj, $conn_dj);$query_rs_productcategory = "SELECT productCat_id, productCat_name, industry_id FROM tbl_productcat WHERE industry_id = '$_GET[industry_id]' ORDER BY productCat_name";$rs_productcategory = mysql_query($query_rs_productcategory, $conn_dj) or die(mysql_error());$row_rs_productcategory = mysql_fetch_assoc($rs_productcategory);$totalRows_rs_productcategory = mysql_num_rows($rs_productcategory);ElseIf ($_POST["field_name"] == "product")mysql_select_db($database_conn_dj, $conn_dj);$query_rs_product = "SELECT products_id, products_name, productCat_id FROM tbl_products WHERE productCat_id = '$_GET[productCat_id]' ORDER BY products_name";$rs_product = mysql_query($query_rs_product, $conn_dj) or die(mysql_error());$row_rs_product = mysql_fetch_assoc($rs_product);$totalRows_rs_product = mysql_num_rows($rs_product);ElseIf ($_POST["field_name"] == "outsidena")mysql_select_db($database_conn_dj, $conn_dj);$query_rs_outsidena = "SELECT * FROM intl_countries ORDER BY intl_countries.name";$rs_outsidena = mysql_query($query_rs_outsidena, $conn_dj) or die(mysql_error());$row_rs_outsidena = mysql_fetch_assoc($rs_outsidena);$totalRows_rs_outsidena = mysql_num_rows($rs_outsidena);Else echo "No valid data submitted"; Just see: http://www.w3schools.com/php/php_if_else.aspRedsun
  9. redsun

    MySQL-Excel

    If you have installed MS Query during the installation of Excel (or Office), you can run a SQL query on any DSN that you have set in your system.Just check your Excel - if you see in the menu 'Data —> Import external data' (sorry, I've non-english version, the name could be a little different), then you are able to load data from your DB.If you don't see it in Data menu, just run the Excel installation again and check MS Query to be installed.A little complication is that you need to set the password to access the DB everytime you run the query. So it's not just like clickin' on one button and query result is here. Good for you is that you can specify where you want do populate the result - on this sheet or new one.All of that assumes that you have access to your DB on the remote server. That should not be so big problem to solve.Redsun
  10. Just try this: SELECT department FROM yourtablename WHERE item_name NOT LIKE 'Geo positioning system' Redsun
  11. Well, I'm glad you have a nice piece of working code now ;o)
  12. redsun

    create message box in asp

    Be more specific please. Do you want some box to pop-up and wait for user interaction (done with javascript) or do you want to write some text into your page (for example from database)?Redsun
  13. Hi, just take a look at this article:http://www.asp101.com/articles/michael/dyn...des/default.aspRedsun
  14. This is not the cause of your problem, but it is better to let the IIS know, what language do you use in your page. So add this on the first line in (every) ASP page: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> 1252 for western langs, or use one of your preferenceNow I looked at the code before the SQL statement - you have If Then clause combined with declaration of session. The session contains your SQL query, but contains also the requested FORM VALUE - it is not only SQL!According to your If Then Else statement - if you run your query for the first time, you save it in the session which "lives" for next 5 minutes in IIS. The statement says - if my query exists, use it. If you session times out or you restart IIS, it will work again just for one time.Just test it in another page by running this: <%=Session("_Query1_rs")%> You will see your SQL query combined with the FORM VALUE. Saying the truth, I don't know why do you have that If Then statement in place, because it blocks the query from running everytime again. If you just copyed the statement from the abowe query which is correct - login procedure is still the same for one user.After removing the If Then Else statement your "sql" code block should look like: <%sql = "SELECT [tblCase].[CaseID], [tblCase].[CaseReceivedDate] AS Received, [tblCase].[CaseClosedDate] AS Closed, [tblPerson].[PersonIDNo], [tblPerson]![PersonNameLast] & ', ' & [tblPerson]![PersonNameFirst] & ' ' & [tblPerson]![PersonNameMI] AS PersonName, [qryPersonCase].[PersonUnit], [tblStaff].[StaffNameLast], [tblPerson].[PersonRetireDate], [tblPerson].[RetireID], 'file:///p:/' & [tblCase]![CaseYear] & '%20CASES/' & [tblCase]![CaseID] & '.pdf' AS [Link to File] FROM ((tblCase INNER JOIN (qryPersonCase INNER JOIN trelPersonAllegation ON [qryPersonCase].[PersonCaseID]=[trelPersonAllegation].[PersonCaseID]) ON [tblCase].[CaseID]=[qryPersonCase].[CaseID]) LEFT JOIN tblStaff ON [tblCase].[CaseAssignTo]=[tblStaff].[StaffID]) INNER JOIN tblPerson ON [qryPersonCase].[PersonID]=[tblPerson].[PersonID] GROUP BY [tblCase].[CaseID], [tblCase].[CaseReceivedDate], [tblCase].[CaseClosedDate], [tblPerson].[PersonIDNo], [tblPerson]![PersonNameLast] & ', ' & [tblPerson]![PersonNameFirst] & ' ' & [tblPerson]![PersonNameMI], [qryPersonCase].[PersonUnit], [tblStaff].[StaffNameLast], [tblPerson].[PersonRetireDate], [tblPerson].[RetireID], 'file:///p:/' & [tblCase]![CaseYear] & '%20CASES/' & [tblCase]![CaseID] & '.pdf' HAVING ((([tblPerson].[PersonIDNo])='" & Request("[ID Number]") & "')) ORDER BY [tblCase].[CaseReceivedDate] " Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sql, conn, 3, 3 If rs.eof Then rs.AddNew End If%> I hope this will help you already ;o)
  15. Please post your code in the current state.
×
×
  • Create New...