与MS代理的数据库连接 [英] Database connection with MS agent
本文介绍了与MS代理的数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
MS代理仅讲一个值,但我要全部.
那么如何通过SPeach迭代所有值
MS agent only speaking only one Value but I want all.
So how will I iterate all values through SPeach
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);
}
推荐答案
好了.这是因为您仅使用一个row
-关键字".您将忽略循环变量row
-它未使用.您看到编译器的警告了吗?
问题解决了.接下来!
关于梅林.他还没预见到你的未来吗? :-)
—SA
Now wonder. This is because you''re using only onerow
— "Keywords". You ignore your cycle variablerow
— it is unused. Did you see a compiler''s warning?
Problem solved. Next!
Regards to Merlin. Didn''t he predict your future yet? :-)
—SA
这篇关于与MS代理的数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文