public static bool IsQueryValid(string queryText, string connectionString, ref string errorMessage) { var sharedResourceFile = DotNetNuke.Common.Globals.ApplicationPath + "/DesktopModules/DNNStuff - SQLViewPro/App_LocalResources/SharedResources.resx"; // valid query and return appropriate error message var msg = ""; var queryValid = true; var catchwordsPassed = true; // check for valid query try { RetrieveData(Compatibility.ReplaceGenericTokensForTest(queryText), connectionString, 0, "Sliding", null); } catch (Exception ex) { queryValid = false; msg = "<br>" + Localization.GetString("QueryTestError", sharedResourceFile) + " : " + ex.Message; } // check for catch words if (!SQLUtil.ContainsCatchWords(queryText)) { catchwordsPassed = false; msg = msg + "<br>" + Localization.GetString("CatchWordsError", sharedResourceFile); } if (!(queryValid && catchwordsPassed)) { errorMessage = msg; return(false); } errorMessage = "<br>" + Localization.GetString("QueryTestOK", sharedResourceFile); return(true); }