Filters using URLs

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

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

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