private void Load_Grammer() { List <string> grammerList = new List <string>(); DataSet dsResults = new DataSet(); try { dsResults = OSAEApi.RunSQL("SELECT `match` FROM osae_pattern_match ORDER BY `match`"); grammerList.Add(gWakePhrase); grammerList.Add(gSleepPhrase); for (int i = 0; i < dsResults.Tables[0].Rows.Count; i++) { grammerList.Add(dsResults.Tables[0].Rows[i][0].ToString()); } } catch (Exception ex) { AddToLog("Error getting Grammer set from the DB!"); AddToLog("Error: " + ex.Message); } try { Choices myChoices = new Choices(grammerList.ToArray()); GrammarBuilder builder = new GrammarBuilder(myChoices); Grammar gram = new Grammar(builder); oRecognizer.LoadGrammar(gram); AddToLog("Grammer Load Completed (" + grammerList.Count + " items)"); } catch (Exception ex) { AddToLog("I could Not build the Grammer set!"); AddToLog("Error: " + ex.Message); } }