Dynamic recordset

So, i have a page that allows a user to select a value from a menu... once they choose the value, and hit submit they then go to a new page that grabs the value and needs to search in a different db table depending on the value of the menu item from their submital.
Here is the problem... how do i tell dreamweaver to basically run a different recordset depending on the value of the menu item... OR, how do i write one dynamic recordset that is set based on the value of the menu item submited.
Thanks for any ideas.

>Yea, i tried that before... but dreamweaver did not like it at all.
Yes, you'll need to code this by hand. And once you modify DW code, you won't be able to manage it with DW server behaviors because DW will no longer recognize it.
>The reason they are looking in different tables is becuase depending
>on the selection they choose the results reside in different tables.
The reason I ask is because 99% of the time people asked about this, it's because they are using multiple tables to store data that belongs in the same table. I don't know enough about your applications, but the fact that each table will return the same result set columns makes me think that might be the case here.

Similar Messages

  • Dynamic recordset for a loop

    Hi,
    I need to loop into a recordset, but I know in which recordset just at the execution time.
    I mean, depending on a condition I can loop into different recordset, but executing same code.
    And I wouldn't write the same code twice.
    Here a little example:
    PROCEDURE dynrec IS
    cursors rec1 is
    select * from tab1;
    cursor rec2 is
    select * from tab2;
    dynamic_rec ????;
    BEGIN
    IF condition THEN
    dynamic_rec := rec1;
    ELSE
    dynamic_rec := rec2;
    END IF;
    FOR r IN dynamic_rec LOOP
    END LOOP;
    END;
    Is it possibile to such a stuff?
    Thanks in advance!
    Samuel

    Firstly, what are you actually trying to achieve?
    Secondly, if your returned rows are different from the different cursors then you can't really fetch then into a single undefined row type variable. The structure of the variable into which the data is to be returned, must be known at design and compilation time, it can't change at run-time.
    Thirdly, what is wrong with simply having a conditional statement that handles each case seperately with their own return variable defined specifically for that query?
    If things truly have to be dynamic (very very little reason why this should ever be justified), then you'd have to use the DBMS_SQL package and the procedures provided by that package to describe the results of the query and fetch the data back...
    example (from my stock answers)...
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.

  • Dynamic Recordset with Oracle ODBC

    I'm trying to create a recordset that will automaticaly update
    itself when the database has changed. I have tried using a
    dynamic cursor but it doesnt work. The cursor type keeps on
    getting set to a keyset cursor type. Does Oracle support
    dynamic cursors? If so, can someone post an example.

    No ODBC driver for Oracle supports the creation of dynamic resordsets. I'm not aware of a driver for any database that does.
    Justin

  • Dynamic recordset field width.

    When I'm placing my fields on my form in my table the width of the field is set to the width of the description of the field and the recordset name ( {myrecordset.myfieldname} ) even though the data of the field may be much smaller than that description, which leaves a lot of empty space on my report.
    Given the above example if this were a field that contained a 5 digit zipcode the form would show the width of 23 ( "myrecordset.myfieldname" ) instead.
    Can this be adjusted and how would I do that?
    Thanks.
    A JM,

    Maybe u can do this. From the table field, from the code u may see
    <table>
    <tr>
    <td>
    </td>
    </tr>
    </table>
    At <td> from above, the field can be adjustable by insert <td width"20%"> or any percentage u want.

  • Drop Down Menu selection query for recordset.

    I am looking to utilize a dynamic drop down menu to query a recordset...I am using Colfusion to import an MS Access database that contains the following fields: "Model Date", "Name", "Points" and "Target".  Each time the database updates, the "Model Date" field contains the date and time the model was run.  I have figured out how to create a dynamic drop down using SELECT DISTINCT "model date" and have also figured out how to create the dynamic recordset to be displayed showing the "Name", "Points" and "Target" data. 
    I want the user to select the "Model Date" from the drop down, hit a submit button and then have the appropriate "Name", "Points" and "Target" data queried and shown below.
    The query should take the selection from the "model date" dropdown and then query the "name", "points" and "target" fields for that particular "model date"
    I admit my knowledge of SQL and Coldfusion is not the best, but it seems like this is a somewhat simple task and I am just missing one or two pieces of the cog to put it all together.
    The database basically looks like this:
    Model Date...........Name..........Points........Target
    8/1/2010 08:00......John Doe.....1,250.........5.55%
    8/1/2010 08:00......Jane Doe.....850............2.35%
    8/1/2010 08:00......Bill Smith....11,832........-123.23%
    8/2/2010 09:02......John Doe.....1,323.........6.67%
    8/2/2010 09:02......Jane Doe.....1,001.........3.21%
    8/2/2010 09:02......Bill Smith....10,235........-110.26%
    The dropdown will only show the "model dates"
    8/1/2010 08:00
    8/2/2010 09:02
    For example, if 8/1/2010 08:00 was selected from the dropdown, I want the following displayed:
    Name..................Points...................Target
    John Doe.............1,250....................5.55%
    Jane Doe.............850.......................2.35%
    Bill Smith............11,832...................-123.23%
    Any help or suggestions would be greatly appreciated!!!
    Thanks,
    Mike

    My second paragraph talks about just displaying the filtered data, so I'm assuming that's what you're looking for, but still not quite sure based on what the other responses are. 
    But I head on anyway -
    On your first page, make note of the instance name of your drop down menu, such as "ModelDate".  Make sure it's in a Form and set the form action to the page where you want to display your data, set the form action to POST.
    On the results page, create a table with cells for each of the data elements you want to display. Create a recordset which you can do in Simple mode. Leave it at select all, and set the filter drop down to the database field which contains your Model Date. In the box to the right, select "=". the next dropdown selct "Form Variable" and the variable name type in the instance name of the drop down on the first page. 
    I may not have the terminology right, doing it from memory.
    From the data bindings tab, expand your recordset and locate each of the database fields you want to display.  Drag each one to the table cell on the page where you want it displayed.  The table cells have to be in a linear row.
    Now, select the table row buy selecting the TR tag in the tags just above the properties panel.  In the server behaviors tab, select repeat region and "All Records"
    Publish your pages and test!

  • XML export trouble

    Im trying to create a dynamic photo gallery using Spry and XML that will ultimately resemble the spry gallery demo(http://labs.adobe.com/technologies/spry/demos/gallery/). My troubles occur when i attempt to create a dataset off of a dynamic recordset in an XMLexport.php file (like the tutorial - Using XML Export to create dynamic Spry data sets) i have trouble.
    I have my dynamic XML file named export.php and when i navigate to export.php it displays the data in the proper format (xml style). My trouble comes when i try to incorporate export.php into my XML dataset. I navigate to the file and click schema and i get a Design Time Feed error. The first line states that it failed to get schema from dynamic data, it then ask me to provide a design time feed.
    When i close the pop-up window i get an error message in the row element window of the - invalid document structure (1,1).
    What am I missing when i do this?
    Just so its easy to establish my document structure i use Xampp on my laptop with htdocs being my root and each site in their own folder within htdocs. I have my localhost set to htdocs so the database will.
    Cheers
    Ryan

    Hi Ryan,
    I navigate to the file and click schema and i get a Design Time Feed error. The first line states that it failed to get schema from dynamic data, it then ask me to provide a design time feed
    at this point Spry´s Dreamweaver UI expects a "hardcoded" XML file containing all the nodes & values etc -- the XML structure and data of your export.php will be parsed and generated by your server, but Dreamweaver itself is no web server and can´t parse PHP files from within.
    That said, code yourself a real XML file containing just one node with "dummy" data, and make sure that its XML structure plus data format will be identical to what your export.php file will also generate -- use this static XML file to feed Spry´s UI, and when your page can be considered "ready for consumption", replace the pointer to your "dummy" XML file with a link to export.php
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • How to change recordset bahaviour to accept dynamic column names in the where clause

    Hi
    im using php-mysql and i make a recordset and i want to make the column names in the where clause to be dynamic like
    "select id,name from mytable where $tablename-$myvar";
    but when i do this my i break the recordset and it disappear
    and when i use variables from advanced recordset it only dynamic for the value of the column not for the column name
    and when i write the column name to dynamic as above by hand it truns a red exclamation mark on the server behaviour panel
    so i think the only way is to change the recordset behaviour is it? if so How to make it accept dynamic column names?
    thanks in advance.

    As bregent has already explained to you, customizing the recordset code will result in Dreamweaver no longer recognizing the server behavior. This isn't a problem, but it does mean that you need to lay out your dynamic text with the Bindings panel before making any changes. Once you have changed the recordset code, the Bindings panel will no longer recognize the recordset fields.
    Using a variable to choose a column name is quite simple, but you need to take some security measures to ensure that the value passed through the query string isn't attempting SQL injection. An effective way of doing this is to create an array of acceptable column names, and check that the value matches.
    // create array of acceptable values
    $valid = array('column_name1', 'column_name2', 'column_name3');
    // if the query string contains an acceptable column name, use it
    if (isset($_GET['colname']) && in_array($_GET['colname'], $valid)) {
      $col = $GET['colname'];
    } else {
      // set a default value if the submitted one was invalid
      $col = 'column_name1'
    You can then use $col directly in the SQL query.

  • Dynamic List Selection as a Parameter in another Recordset

    Please help.
    I have an ASP VBScript webpage. The first field on this page
    is a dynamic menu / list which lists footballers from a recordset.
    Whichever player is selected I then want to populate additional
    fields on the page (e.g. team he plays for) based on the selection.
    I was trying to extract the field value to a variable MM_Var6
    = Cstr(Request.Form(("PlayerName2")) and then use MM_Var6 in the
    WHERE statement of an additional recordset e.g. WHERE
    Teams.Playername = MM_Var6
    but can't help feeling there has to be an easier way of
    getting the data from the table rather than using an additional
    recordset. The above way doesn't seem to extract the value
    correctly from the list field.
    Am I just using the wrong syntax? or is there a better way of
    doing this?
    Can someone please point me in the right direction? Thanks,
    Chris.

    Try below:
    http://blogs.msdn.com/b/jackiebo/archive/2007/02/27/displaying-a-list-on-another-site-in-the-same-site-collection.aspx
    http://sharepointgeorge.com/2009/display-sharepoint-list-site-data-view-web-part/
    http://sharepoint.stackexchange.com/questions/37140/display-list-or-library-on-another-site-as-webpart
    http://stackoverflow.com/questions/938580/showing-the-list-view-web-part-for-a-list-in-another-site

  • Linking to file in site folder using recordset in dynamic table

    I have a dynamic, repeating table that lists recordsets from a database.  I would like to add a column to the table that contains a link to a file in a folder contained on the site.  The name of the file used will be the same as one of the recordset value, 'cas_num' (all within the same row of the dynamic table).
    My code so far is:
    <tr>
              <td nowrap="nowrap"><?php echo $row_Recordset1['id']; ?></td>
              <td width="160" nowrap="NOWRAP"><?php echo $row_Recordset1['cas_num']; ?></td>
              <td nowrap="NOWRAP"><?php echo $row_Recordset1['chem_name']; ?></td>
              <td nowrap="nowrap"><?php echo $row_Recordset1['m_formula']; ?></td>
              <td nowrap="NOWRAP"><?php echo $row_Recordset1['room']; ?></td>
              <td nowrap="NOWRAP"><?php echo $row_Recordset1['location']; ?></td>
              <td nowrap="nowrap"><?php echo $row_Recordset1['inst']; ?></td>
              <td nowrap="nowrap"><?php echo $row_Recordset1['amount']; ?></td>
              <td nowrap="nowrap"><?php echo $row_Recordset1['a_type']; ?></td>
              <td nowrap="nowrap"><?php echo $row_Recordset1['supplier']; ?></td>
              <td nowrap="nowrap"><?php echo $row_Recordset1['pt_num']; ?></td>
              <td nowrap="nowrap"><?php echo '<a href="/docs/MSDS/'$row_Recordset1['cas_num']; ?>'MSDS</a>;</td>
              </tr>
    Any help with this how to link to the file would greatly be appreciated!
    thanks,
    chemsafety.

    If you can mount the server on your desktop and have access via the Finder to the file, then you can select the text you'll use for the link and in the link section of the Inspector window select the option for A file. Then in the navigation window, go to the server on the desktop and from there to the file on the server. That's one way to do it.
    The other is to figure out the URL for a file on the server. I know how to do it for the iDisk. It would be something like this for another server:
    http://server name/your account's folder/the folder containing the file.
    You'll have to determine the path to the file. As I said earlier if you can mount the server on the desktop that would let you determine the path or use the first method.
    Do you Twango?

  • Dynamic List Wizard error - can't connect to recordset or table

    I'm using Windows Vista, CF 8, and DW CS3.
    I have just started working with the Dynamic List Wizard and cannot get it to work. I have tried both options: get data from recordset, and get data from table. When I click on "finish" I get the following error message: Please select a connection that contains tables for updating, or click cancel.
    Everything appears to be good to go. I've refreshed my recordset, my database connections, etc. Has anybody else had this issue and what is the workaround?
    Also, is there a tutorial out there ANYWHERE for this part of the extension? Interakt had such great Flash demos ... what's up with Adobe? No Flash demos for this extension?
    Thanks!

    Backing up to a third-party NAS with Time Machine is risky, and unacceptably risky if it's your only backup. This is an example of what can happen. If the NAS doesn't work, your only recourse is to the manufacturer (which will blame Apple.)
    If you want network backup with Time Machine, use as the destination either an Apple Time Capsule or an external hard drive connected to another Mac or a mini-tower (802.11ac) AirPort base station. Only the 802.11ac base station supports Time Machine, not any previous model.

  • Using Dynamic Data in "Send E-Mail To Recipients From Recordset"

    Hi,
    How can I use Dynamic Data embedded in recordset field ?

    I try another way to do it, using a html link
    > function Trigger_EmailRecordset_E6(&$tNG) {
    $rsemailObj = new tNG_EmailRecordset($tNG);
    $rsemailObj->setRecordset("rsTasks");
    $rsemailObj->setFrom("{KT_defaultSender}");
    $rsemailObj->setTo("email_to");
    $rsemailObj->setSubject("{rsTasks.lib_task}");
    //WriteContent method
    $rsemailObj->setContent("{rsTasks.email_text}\n</br>\n</br>\n{rsTasks.url_document}</br>< /br>
    <a href=\"http://xxx.xxx.xxx.xxx/yyyyyyyy/{rsTasks.url_document}\">Clic here</a>");
    $rsemailObj->setEncoding("UTF-8");
    $rsemailObj->setFormat("HTML/Text");
    $rsemailObj->setImportance("High");
    return $rsemailObj->Execute();
    I wonder if I could use Dynamic Data _INSIDE_ {rsTasks.email_text} field ?
    Thanks. JM.

  • Problems with recordset paging and dynamic menu displaying all the options

    Hi hope someone can help on this - I've posted the code on the FoEd Backend Blight - with no takers/success yet -
    I've created a jobs page using DWCS3 which has a dynamic drop down menu filtering the 'countries' that jobs are located in.  When I introduce a recordset page only those countries associated with the jobs on that particular page are shown in the dynamic menu above, not all of the countries listed in the database. When I get to the second page of results - again - only those jobs' countries are shown in the menu (and not the previous pages/next pages as well).
    I'd clearly like a user to be able to select from the menu of countries available for all the jobs in the database, and not just those on the page.  Any ideas?
    On a similar strain - my country menu/filter is wrapped up in a form above the list of jobs.  On loading the page, only the search and menus appear.  No jobs are shown until I hit submit.  Is there a way to have all the jobs display on first load, and then for the search/menu filter to work on the displayed jobs. I've tried altering the variables on the search to 1 from -1, and other options but I can't seem to get a page of content on first load.
    I'd really appreciate any pointers on the above, as this would help solve the final stage of my project. The full post and code can be seen on the friendsofed website under backend blight.
    Many thanks in advance.
    Matt

    I'm still stuck on getting the page to load with some actual content, however.  I'm just getting the search box and country filter displaying on first load.
    Pages 584-6 explain why you get nothing when a page first loads. Dreamweaver sets the default value to -1. The problem with trying to change the default value even to an empty string or % is that Dreamweaver's security function, GetSQLValueString() changes an empty string to NULL and wraps % in quotes, so neither will work.
    One way to display all records when the page first loads is to create another recordset that selects all records. Wrap the code in a conditional statement that checks whether the $_GET array contains any values:
    if (!$_GET) {
      // recordset to retrieve all records here
    This means that you need two repeat regions to display the results. Wrap both of them in conditional statements:
    if (isset($fullRecordsetName)) {
      // display the full recordset
    } elseif (isset($searchResultsRecordsetName)) {
      // display the search results
    You also need to wrap the mysql_free_result() statements in conditional statements at the end of the page:
    if (isset($fullRecordsetName)) mysql_free_result($fullRecordsetName);
    if (isset($searchResultsRecordsetName)) mysql_free_result($searchResultsRecordsetName);
    Another way to do it is to use just one recordset, but split the SQL query into two sections:
    $query_RecordsetName = "SELECT * FROM myTable";
    if (isset($_GET['searchTerm')) {
    $query_RecordsetName .= sprintf(" WHERE searchTerm LIKE %s",
         GetSQLValueString("%" . $colname_RecordsetName . "%", "text"));
    This uses the combined concatenation operator to add the WHERE clause to the query only if $_GET['searchTerm'] has been set. Notice that you need a space before the "WHERE".

  • Dynamic Query Recordset Display

    This is a snippet of code from ASP that I am trying to
    translate into its equilvelent in ColdFusion. If anyone could help
    me I would greatly appreciate it.
    for each field in rs.fields
    response.write(field.name)
    next
    do until rs.eof
    for each field in rs.fields
    response.write(rs(field.name))
    next
    rs.movenext
    loop
    The purpose of this snippet is to display all the columns and
    all the values for those columns on any recordset
    dynamically.

    Found it.
    <table border="1">
    <tr>
    <cfloop list="#searchresults.ColumnList#"
    index="column">
    <cfoutput><th>#column#</th></cfoutput>
    </cfloop>
    </tr>
    <cfoutput query="searchresults">
    <tr>
    <cfloop list="#searchresults.ColumnList#"
    index="column">
    <td>#Evaluate(column)#</td>
    </cfloop>
    </tr>
    </cfoutput>
    </table>
    Source:
    http://www.sitepoint.com/article/data-structures-4-queries
    though their code was slightly off.

  • Dynamic column in recordset

    CS3 / ASP / VBScript
    How can I select what column gets searched based on the a URL
    paramenter? Here's what I'm trying to do:
    there are two fields in the search form: a textfield and a
    drop-down menu. A word or phrase can be enbtered in the first field
    and the user can select COMPANY NAME or KEYWORDS from the
    drop-down. The drop-down determines what database column is
    searched.
    How would the SQL look for this?
    Here's what I have:
    SELECT *
    FROM dbo.theList
    WHERE varBy LIKE %MMColParam%
    ORDER BY Name ASC
    and here is how the paramenters:
    varBy is set to: Request.QueryString("by")
    MMColParam is set to: Request.QueryString("for")
    This returns a blank recordset.

    "Joris van Lier" <[email protected]> wrote in message
    news:fccfq8$shj$[email protected]..
    > "Mardirousi" <[email protected]> wrote
    in message
    > news:fccfjn$sdf$[email protected]..
    >> Dim rsResults
    >> Dim rsResults_cmd
    >> Dim rsResults_numRows
    >>
    >> Set rsResults_cmd = Server.CreateObject
    ("ADODB.Command")
    >> rsResults_cmd.ActiveConnection = MM_connData_STRING
    >> rsResults_cmd.CommandText = "SELECT * FROM
    dbo.busListing WHERE ? LIKE ?
    >> ORDER
    >> BY Name ASC"
    >> rsResults_cmd.Prepared = true
    >> rsResults_cmd.Parameters.Append
    rsResults_cmd.CreateParameter("param1",
    >> 200,
    >> 1, 255, "%" + rsResults__neoBy + "%") ' adVarChar
    >> rsResults_cmd.Parameters.Append
    rsResults_cmd.CreateParameter("param2",
    >> 200,
    >> 1, 255, "%" + rsResults__neoFor + "%") ' adVarChar
    >>
    >> Set rsResults = rsResults_cmd.Execute
    >> rsResults_numRows = 0
    >
    >
    > Seems correct to me the parameters are defined as
    adVarChar with
    > sufficient length.
    > Lets see the whole page...
    Wait I see it now, your neoBy variable is enclosed in percent
    signs, try it
    like this
    Dim rsResults
    Dim rsResults_cmd
    Dim rsResults_numRows
    Set rsResults_cmd = Server.CreateObject ("ADODB.Command")
    rsResults_cmd.ActiveConnection = MM_connData_STRING
    rsResults_cmd.CommandText = "SELECT * FROM dbo.busListing
    WHERE ? LIKE ?
    ORDER BY Name ASC"
    rsResults_cmd.Prepared = true
    rsResults_cmd.Parameters.Append
    rsResults_cmd.CreateParameter("param1", 200,
    1, 255, rsResults__neoBy) ' adVarChar
    rsResults_cmd.Parameters.Append
    rsResults_cmd.CreateParameter("param2", 200,
    1, 255, "%" + rsResults__neoFor + "%") ' adVarChar
    Set rsResults = rsResults_cmd.Execute
    rsResults_numRows = 0

  • Building recordset query dynamically based on form parameter availability

    Hi,
    I have a real estate property table that I'd like to query.
    The form itself let's the user search by state, county, zip code
    etc. The user need not enter all the information. For eg: If the
    user just selects a state and searches, I should list all
    properties that belong to that state. But if the user also selects
    a county along with state then I should filter the results by state
    AND county. This situation applies for a lot of the form
    parameters.
    Now, in Dreamweaver when I try to create a recordset, I want
    to append
    AND county = $_REQUEST['county']
    to the end of my record set query if and only if the user
    selected a county. If the user didn't select the county, I do not
    want to have that as part of my query.
    Is there an easy way to do this in DW? I understand that
    variables let you define a default var. I donot even want to
    specify a default value.
    Any help is greatly appreciated.
    Thanks!!

    You'll have to write the code yourself but something like
    this...
    sqlString = "SELECT .... "
    if user selects county (probably a drop down list) then
    sqlString = sqlString + " AND county = " + $_REQUEST
    then just send the sqlString to the server.
    "flash0777" <[email protected]> wrote in
    message
    news:e40b1o$bok$[email protected]..
    > Hi,
    >
    > I have a real estate property table that I'd like to
    query. The form
    > itself
    > let's the user search by state, county, zip code etc.
    The user need not
    > enter
    > all the information. For eg: If the user just selects a
    state and
    > searches, I
    > should list all properties that belong to that state.
    But if the user also
    > selects a county along with state then I should filter
    the results by
    > state AND
    > county. This situation applies for a lot of the form
    parameters.
    >
    > Now, in Dreamweaver when I try to create a recordset, I
    want to append
    > AND county = $_REQUEST
    > to the end of my record set query if and only if the
    user selected a
    > county.
    > If the user didn't select the county, I do not want to
    have that as part
    > of my
    > query.
    >
    > Is there an easy way to do this in DW? I understand that
    variables let you
    > define a default var. I donot even want to specify a
    default value.
    >
    > Any help is greatly appreciated.
    >
    > Thanks!!
    >

Maybe you are looking for