1 Replies - 165 Views - Last Post: 19 May 2020 - 11:23 AM Rate Topic: -----

#1 guhananth   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-May 20

Form required string based on index

Posted 19 May 2020 - 10:23 AM

hi
i have dynamic sql string
Hi,
I have string like
WHERE Ticket Update Via = Support (T3) AND Status= Closed OR Pending=Open
i want to form required string based on

A)for column name Ticket Update Via it should replace with “Tickets”
B)If it is AND operator we need to get text as Status= Closed
C)If it is OR operator we ned to get text as Pending= Open,
then form it as single string,
Below is my code

string str= “WHERE Ticket Update Via = Support (T3) AND Status= Closed OR Pending=Open”

        bool strOperator= false;
        int strBegin = 0;
        string st = "WHERE";
        string strFunc = "AND";
        while (true)
        {

            int start = str.IndexOf(st) + st.Length +1 ;

            int end = str.IndexOf(strFunc, start);
            // Search AND
            break;
       }
:code:

This post has been edited by modi123_1: 19 May 2020 - 11:08 AM
Reason for edit:: In the future please use the [code] tags in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: Form required string based on index

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15728
  • View blog
  • Posts: 63,013
  • Joined: 12-June 08

Re: Form required string based on index

Posted 19 May 2020 - 11:23 AM

Okay I am not sure what you are asking for tried.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1