Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

Is there a way to bind my own custom created recordset into DW's bindings panel???

I've got a little problem where I'm working with XML web services to get product data to my web site.  I'm actually parsing all of the XML data and feeding it into an ASP recordset in my page manually.  I have a 3rd party shopping cart (Web Assist eCart 3.7) that uses the bindings tab in DW to populate your shopping cart with data from a recordset.  The problem is, since this recordset wasn't actually created with DW it doesn't show up in the bindinds tab and my shopping cart extension doesn't work then (it simply grays out the dynamic shopping cart option because there isn't a recordset available...so it thinks.)

So, is there a way that I can bind my own recordset data in DW so that it can be used just like a regular recordset created in DW?  I see how you can bind Session variables and Application variables but I don't see anything for binding a manually created recordset.

Any information on this would be greatly appreciated.  Thanks!
0
Andrew Angell
Asked:
Andrew Angell
  • 3
  • 2
  • 2
1 Solution
 
Mark GilbertSenior Performance EngineerCommented:
Yea, insert your custom query into the advanced sql editor (which is available when creating a new recordset).  However, if your code contains things like where fieldname = '$x', the $x will bomb it out with an error.  What you could do is simply replace the $varname with a default value so that you can construct your code in dreamweaver, and the put the variable names back into the query.

Hope this helps.
0
 
Andrew AngellAuthor Commented:
That's not really what I'm talking about.  I'm not accessing the database via SQL queries.  I'm accessing the database via XML API. The XML values are placed into ASP variables and then fed into a recordset...that I was hoping to be able to use like any other recordset in DW.

---


      Const adVarChar = 200
 
'Create recordset to store data in to make everything work with eCart.
  Set rsProducts = CreateObject("ADODB.Recordset")
        rsProducts.Fields.Append "ProductRefNumber", adVarChar, 1000
      rsProducts.Fields.Append "ProductQTYAvailable", adVarChar, 1000
      rsProducts.Fields.Append "ProductCondition", adVarChar, 1000
      rsProducts.Fields.Append "ProductDescription", adVarChar, 1000
      rsProducts.Fields.Append "ProductManuPartNumber", adVarChar, 1000
      rsProducts.Fields.Append "ProductStreetPrice", adVarChar, 1000
      rsProducts.Fields.Append "ProductWeight", adVarChar, 1000
      rsProducts.Fields.Append "ProductCategory", adVarChar, 1000
      rsProducts.Fields.Append "ProductHot", adVarChar, 1000
      rsProducts.Open()
 
 'open the XML document
      Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
      xmlDoc.Async = false
      xmlDoc.LoadXML(InventoryResponse)
      
'parse records from response
      Set RecordsNode = xmlDoc.selectNodes("/fmresultset/resultset/record")
            For Each recordNode In RecordsNode
                  ProductRefNumber = ""
                  ProductQTYAvailable = ""
                  ProductCondition = ""
                  ProductDescription = ""
                  ProductManuPartNumber = ""
                  ProductStreetPrice = ""
                  ProductWeight = ""
                  ProductCategory = ""
                  ProductHot = ""
                  
                  ProductRefNumber = TryNode(recordNode, "field[@name='Ref_Number']/data")
                  ProductCondition = TryNode(recordNode, "field[@name='Purchase_Order_Items::Condition']/data")
                  ProductDescription = TryNode(recordNode, "field[@name='Ref_Number::Description']/data")
                  ProductManuPartNumber = TryNode(recordNode, "field[@name='Ref_Number::Manu_Part_Number']/data")
                  ProductCategory = TryNode(recordNode, "field[@name='Ref_Number::Class']/data")
                  ProductHot = TryNode(recordNode, "field[@name='Ref_Number::Hot']/data")
                  ProductStreetPrice = FormatNumber(TryNode(recordNode, "field[@name='Ref_Number::Street']/data"),2)
                  ProductWeight = TryNode(recordNode, "field[@name='Ref_Number::Weight']/data")
                  ProductQTYAvailable = TryNode(recordNode, "field[@name='Qty_Available']/data")
                  
                  rsProducts.AddNew
                        rsProducts("ProductRefNumber") = ProductRefNumber
                        rsProducts("ProductCondition") = ProductCondition
                        rsProducts("ProductDescription") = ProductDescription
                        rsProducts("ProductManuPartNumber") = ProductManuPartNumber
                        rsProducts("ProductCategory") = ProductCategory
                        rsProducts("ProductHot") = ProductHot
                        rsProducts("ProductStreetPrice") = ProductStreetPrice
                        rsProducts("ProductWeight") = ProductWeight
                        rsProducts("ProductQTYAvailable") = ProductQTYAvailable
                  rsProducts.Update
            Next
      Set RecordsNode = Nothing

---

So at this point I have a recordset that contains all of the data that I can display to the page by looping through it just like normal...but I have to do it all manually because I can't bind the recordset into DW...or at least I don't know to.
0
 
Jason C. LevineNo oneCommented:
Hi angelleye,

I think you can do this using the File | Convert command:

http://www.adobe.com/devnet/dreamweaver/articles/display_xml_data_05.html
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
Andrew AngellAuthor Commented:
jason1178,

that's a cool feature, but that's for using XSLT.  that's not what I'm doing here.  I'm just trying to find a way to add a manually created recordset into DW's bindings panel.
0
 
Jason C. LevineNo oneCommented:
Ok, sorry...that's the closest thing my research could come up with.  In that case, ingwa is correct about the advanced recordset dialog.  If you cannot call the query from the DW dialogs, then DW won't make it accessible via the bindings panel, AFAIK.  

However, this is ASP and I'm not totally certain how DW and ASP do their things.   In PHP, DW uses a regular expression to check the recordset code and if it falls into a certain format, it then attaches the recordset to the bindings panel.  I can only assume the same thing exists in ASP...
0
 
Mark GilbertSenior Performance EngineerCommented:
Hi Jason, yes, dreamweaver can interact with asp quite nicely, but the code generated is clunky.   I wouldn't use DW asp for auto-generated content, but find asp good for inserting snippets of code, so it serves the best of both worlds where it fails.

Angelleye, if you do want to try it, insert your binding, but where you have variables put in default values so that DW doesn't give you errors when it queries the database.  Then once you have you repeat regions in place and have formatted your code, copy the select block, comment out the original and then paste it and modify to pickup variable values.  Then your code should work nicely, and it will appear in the behaviours menu.
0
 
Jason C. LevineNo oneCommented:
Hi mrichmon,

No points to me.  I was totally going down the wrong track here.  ingwa only.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now