locked
Getting results from confirmation activity RRS feed

  • Question

  • I am new to this windows workflow and speech server and ran into a problem.  I am trying to pass a value i receive from a getandconfirm activity to a codeactivity that looks up data in sql.  I can't seem to find the correct output i need for ProdID = "";  Basically the user gives a 2 digit id and it gets confirmed back.  Now i need to take that 2 digit ID and pass it to sql for the result.  I can hardcode a number into ProdID = "";  and it works so i know the connection works, but i need this to be my variable. Thanks

    private void getProdID_TurnStarting(object sender, TurnStartingEventArgs e)  
            {  
     
            }  
     
            private void getProdID_ConfirmationTurnStarting(object sender, TurnStartingEventArgs e)  
            {  
               ProdID = getProdID.RecognitionResult.Text;  
     
                getProdID.ConfirmationPrompts.MainPrompt.SetText(  
                   string.Format(System.Globalization.CultureInfo.CurrentCulture,  
                   this.GetPromptResource(this.getProdID.ConfirmationPrompts.MainPrompt.Id), ProdID));  
            }  
     
            private void codeActivity1_ExecuteCode(object sender, EventArgs e)  
            {  
                  
                    SqlConnection conn = null;  
                    SqlDataReader reader = null;  
     
                    ProdID = "";  
     
                    ///string ProdName = IDResponse.MainPrompt.AppendText(Convert.ToString(reader["ProductName"]));  
     
                    try  
                    {  
                         
     
                        conn = new SqlConnection("Data Source=MEGATRON\\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True");  
                        conn.Open();  
     
                        SqlCommand cmd = new SqlCommand("SELECT * FROM [Current Product List] WHERE ProductID = @ProdID", conn);  
     
                        SqlParameter param = new SqlParameter();  
                        param.ParameterName = "@ProdID";  
                        param.Value = ProdID;  
     
                        ///SqlParameter param2 = new SqlParameter();  
                        ///param.ParameterName = "@ProdName";  
                        ///param.Value = ProdName;  
     
                        cmd.Parameters.Add(param);  
     
                        reader = cmd.ExecuteReader();  
     
                        IDResponse.MainPrompt.ClearContent();  
                        IDResponse.MainPrompt.AppendText("The Product Name is");  
                          
                        while (reader.Read()==true)  
                        {  
     
                            IDResponse.MainPrompt.AppendText("{0}",  
                                Convert.ToString(reader["ProductName"]));  
                            ///IDResponse.MainPrompt.AppendText(Convert.ToString(reader["ProductName"]));  
                            IDResponse.MainPrompt.AppendBreak(Microsoft.SpeechServer.Synthesis.PromptBreak.Small);  
     
                        }  
     
                        reader.Close();  
                          
                    }  
     
                    catch  
                    {  
     
                        IDResponse.MainPrompt.SetText("Epic Failure");  
     
                    }  
     
                    finally  
                    {  
     
                        conn.Close();  
     
                    } 
    Monday, February 23, 2009 4:43 PM

All replies

  • You can access the RecognitionResult from nywhere in the workflow. Whey are you setting it = "" in the code activity.

    Pass this into your Stored Proc Paramater (getProdID .RecognitionResult.Text)
    Wednesday, April 1, 2009 9:09 PM