# Filters using URLs

**URL:** <https://community.dreamfactory.com/t/filters-using-urls/1485>\
**Category:** Client SDKs\
**Created:** [September 18, 2015, 5:54pm UTC](https://community.dreamfactory.com/t/filters-using-urls/1485 "2015-09-18T17:54:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickedw](https://avatars.discourse-cdn.com/v4/letter/w/aeb1de/32.png) [@wickedw](https://community.dreamfactory.com/u/wickedw)\
**Post date:** [September 18, 2015, 5:54pm UTC](https://community.dreamfactory.com/t/filters-using-urls/1485/1 "2015-09-18T17:54:12Z")

</div>

Hi,

If I wanted to perform a filter on a “URL” field (this is in fact to check the url does not exist already in the database before I add it), how would I do this using .Net SDK)?

I suppose this is the case for any filter with characters which need to be escaped in some way.

i.e.

var query = new SqlQuery { filter = "url = " + url, fields = “\*” };  
var record = new List(await databaseApi.GetRecordsAsync(“SomeRecord”, query));

gives me the error -

500 - Failed to retrieve records from ‘SomeRecord’.  
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near ‘http:’.

Thanks again for your help,  
Matt

---

<div class="post-metadata">

**Author:** ![makosovic](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/makosovic/32/384_2.png) [@makosovic](https://community.dreamfactory.com/u/makosovic)\
**Post date:** [September 18, 2015, 6:47pm UTC](https://community.dreamfactory.com/t/filters-using-urls/1485/2 "2015-09-18T18:47:58Z")

</div>

Hi Matt,

Filter uses SQL like syntax so you have to enclose the string in single quotes.

`
var query = new SqlQuery { filter = string.Format("url = '{0}'", url), fields = "*" };
`

In order to get SQL query

`
SELECT 
  * 
FROM [table]
WHERE url = 'http:\\\dreamfactory.com'
`

Regards  
Marko

---

<div class="post-metadata">

**Author:** ![wickedw](https://avatars.discourse-cdn.com/v4/letter/w/aeb1de/32.png) [@wickedw](https://community.dreamfactory.com/u/wickedw)\
**Post date:** [September 19, 2015, 5:01pm UTC](https://community.dreamfactory.com/t/filters-using-urls/1485/3 "2015-09-19T17:01:20Z")

</div>

Thanks Marko, makes sense if filter being directly passed through.
