You are viewing limited content. For full access, please sign in.

Question

Question

Advanced Search String formating rules C#

SDK
asked on August 20, 2014

 Greetings,

I am trying to preform a search using an advanced search string.  However I cannot seem to get the syntax correct for C#.net.  Here is my code, see the "searchString" argument;

 

 // Using the overloaded RepositoryRegistration constructor
            RepositoryRegistration myRepoReg = new RepositoryRegistration("DevLF2.osds.com", "Development9");
            Session mySess = new Session();
            mySess.LogIn(myRepoReg);

            // ====== Lookup Chart Number ====== 8/20/2014
            Search LFSearch = new Search(mySess);
            string searchString = "{LF:Name="*56565656", Type="F"}";
            LFSearch.Command = searchString;
            LFSearch.Run();

thanks for your assistance in advance!!

 

Phil

0 0

Answer

SELECTED ANSWER
replied on August 20, 2014 Show version history

You can escape the quotes in your searchString individually with \ like so:

string searchString = "{LF:Name=\"*56565656\", Type=\"F\"}";

Edit: removed the verbatim (@) option; I forgot that " must still be escaped in verbatim strings in c#.

0 0

Replies

replied on August 20, 2014 Show version history

Your search string looks fine to me. Just make sure you escape the inner quotes after name and type with backslashes.

1 0
SELECTED ANSWER
replied on August 20, 2014 Show version history

You can escape the quotes in your searchString individually with \ like so:

string searchString = "{LF:Name=\"*56565656\", Type=\"F\"}";

Edit: removed the verbatim (@) option; I forgot that " must still be escaped in verbatim strings in c#.

0 0
replied on August 21, 2014

Brianna,

Thanks I have not quite gotten the hang of escape process in c# yet. Again thanks for all your help

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.