Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
MS agent only speaking only one Value but I want all.
So how will I iterate all values through SPeach

C#
SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=Mychat;Integrated Security=True");
            con.Open();
            SqlCommand cmd = new SqlCommand("select  * from KWRD", con);
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            adp.Fill(ds, "KWRD");
            foreach (DataRow row in ds.Tables["KWRD"].Rows)
            {
                string  s1 = row["Keywords"].ToString();
               MessageBox.Show(s1);
                 this.axAgent2.Characters.Load("Merlin", @"C:\Windows\MSAgent\chars\merlin.acs");
                AgentObjects.IAgentCtlCharacterEx character = this.axAgent2.Characters.Character("Merlin");
                character.Show(null);
                 character.Speak(s1, null);

            }
Posted
Updated 11-Apr-11 22:59pm
v2
Comments
m@dhu 12-Apr-11 5:00am    
Always wrap your code in pre blocks for better readability.
manasBonton 15-Apr-11 2:16am    
sir i have aleardy connect MS agent with Database.But it speaking only first value. But i want it should speak all value.
Pong D. Panda 12-Apr-11 5:20am    
Can you further clarify your question. What is SPeach?
Dylan Morley 12-Apr-11 5:23am    
lolol, Speech - trying to make the character speak!

I read it like that at first - SP-Each
manasBonton 15-Apr-11 2:16am    
sir i have aleardy connect MS agent with Database.But it speaking only first value. But i want it should speak all value.

1 solution

Now wonder. This is because you're using only one row — "Keywords". You ignore your cycle variable row — it is unused. Did you see a compiler's warning?

Problem solved. Next!
Regards to Merlin. Didn't he predict your future yet? :-)

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900