How to write queriestring inside the xml file and how to replace the value of a string in the querystring
Hi All,
I have a function call in file1.aspx.cs where I am passing two string values as below.
string strQuery = GlobalQuery.GetQuery(seccondSelection, prefixText);
and inside the GlobalQuery class I have the following code for the static function GetQuery.
public static string GetQuery(string strType, string strLikeChar)
{
strAT = "sample 1";
strMK = "sample 2";
strSN = "sample 3";
string strReturn = string.Empty;
string strDynamic = string.Empty;
strDynamic = "Dynamic";
if ((strLikeChar != "") && (strType != "Aircraft")) strDynamic = strType + "_" + strDynamic;
else strDynamic = strType;
dynamicString = strLikeChar.ToUpper(); //first change
switch (strDynamic)
{
case "Aircraft_Dynamic":
strReturn = "SELECT h.FUNCTION_NO, Eng_Function_API.Get_Description(FUNCTION_NO) Func_desc "
+ " FROM test_table h "
+ "FROM test_table h WHERE h.PRODUCT_NO = '" + strAT + "'"
+ " AND h.MODEL_NO = '" + strMK + "'"
+ " UPPER(Eng_Function_API.Get_Description(FUNCTION_NO)) LIKE '" + dynamicString + "%'"
+ " and h.parent_function_no is null ";
break;
case "Aircraft":
strReturn = "SELECT h.FUNCTION_NO,Eng_Function_API.Get_Description(FUNCTION_NO) Func_desc "
+ "FROM test_table h WHERE h.PRODUCT_NO = '" + strAT + "'"
+ " AND h.MODEL_NO = '" + strMK + "'"
+ " and h.parent_function_no is null ";
break;
// have 2 more case values which will retrieve different set of data.
}
}
Now I want know how to write the query part (highlited in red) in XMlL file and how to replace string values inside the query in XML file(highlited in blue)..
I also want to know how to get that querystring from the XML file
string strQuery = GlobalQuery.GetQuery(seccondSelection, prefixText); // GlobalQuery.GetQuery(seccondSelection, prefixText); should be replaced by the XML file which should contain the query part.
Thanks, Sachi