UltimateSitemap
Topic: Where to use 'WHERE'
Karamasoft Support Forums

Page 1 of 1 (12 items)


Posted by TonyP on 05-02-2006 7:59 AM
Hi,

I need to filter the ultimatesitemap table during query, I cannot see anything in code behind where this could be used, is there an easy way to do this.

Thanks

Tony

Posted by Karamasoft on 05-02-2006 9:32 AM
It's doing everything behind the scenes based on a predefined query. If you want to override it you need to create your own dataset using your own query, and then set the DataSource property of UltimateSitemap as in the DataBinding sample.

Posted by TonyP on 05-03-2006 1:26 AM
That makes sense! do you have any examples or documentation on how this is done using a SQL server database?

Thanks for your help.

Posted by Karamasoft on 05-03-2006 8:51 AM
file:///C:/Inetpub/wwwroot/Karamasoft/UltimateSitemap/v2.1/Controls/Documents/UltimateSitemapTutorial.htm#Q7

Posted by TonyP on 05-03-2006 9:41 AM
I'm using C#, the example is in VB, do you have an example in C#

Thanks, and sorry for being a pain in the ***

Tony

Posted by Karamasoft on 05-03-2006 9:54 AM
string connStr = "YOUR CONNECTION STRING GOES HERE";
string sitemapId = "Sitemap1";
OleDb.OleDbDataAdapter adpSitemap =
new OleDb.OleDbDataAdapter(("SELECT * FROM UltimateSitemap WHERE
(sitemapID = \'" + (sitemapId + "\') ORDER BY parentNodeID, sortOrder")), connStr);
DataSet sitemapDataSet = new DataSet("UltimateSitemap");
adpSitemap.Fill(sitemapDataSet, "UltimateSitemap");
UltimateSitemap1.DataSource = sitemapDataSet;

Posted by TonyP on 05-04-2006 7:48 AM
Hi,
I get this error:

error CS0246: The type or namespace name 'OleDb' could not be found (are you missing a using directive or an assembly reference?)

Any clues?
Thanks
Tony

Posted by Karamasoft on 05-04-2006 9:08 AM
You may need to use SqlClient instead of OleDb. Please get more familiar with ADO.NET and ADO.NET 2.0 at http://msdn.microsoft.com/library and http://msdn2.microsoft.com/library repesctively based on the .NET framework you use.

Posted by TonyP on 05-07-2006 12:41 PM
Hi,
I am using a trial version, and am up against it, normally I would send many hours researching, but, it possible you can assist with this?
I know you have better things to do, just a few more hints as to the correct direction??????

Thanks

Tony

Posted by Karamasoft on 05-08-2006 9:09 AM
Are you using .NET Framework 1.1 or 2.0?

Posted by TonyP on 05-08-2006 9:25 AM
.NET 2.0, for my sins!!

Thanks

Tony

Posted by Karamasoft on 05-08-2006 10:05 AM
Please find below the code we tested with. Also note that we created a database called "sitemap" and created the "UltimateSitemap" table in it. You may need to follow the steps in the tutorial to create and fill in this table if you haven't done so:

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

string connStr = "Provider=SQLOLEDB;User ID=username;Password=password;Initial Catalog=sitemap;Data Source=(local);";

string sitemapId = "Sitemap1";

System.Data.OleDb.OleDbDataAdapter adpSitemap = new System.Data.OleDb.OleDbDataAdapter(("SELECT * FROM UltimateSitemap WHERE (sitemapID = \'" + (sitemapId + "\') ORDER BY parentNodeID, sortOrder")), connStr);

DataSet sitemapDataSet = new DataSet("UltimateSitemap");

adpSitemap.Fill(sitemapDataSet, "UltimateSitemap");

UltimateSitemap1.DataSource = sitemapDataSet;

}

}