0
我有這樣的說法:顯示語句的輸出在BalloonTipText在NotifyIcon的
cmd = new SqlCommand("select name,lname from table1 where column1='" + x + "'");
我想表明它在BalloonTipText在NotifyIcon的輸出,我該怎麼辦呢?
我有這樣的說法:顯示語句的輸出在BalloonTipText在NotifyIcon的
cmd = new SqlCommand("select name,lname from table1 where column1='" + x + "'");
我想表明它在BalloonTipText在NotifyIcon的輸出,我該怎麼辦呢?
StringBuilder sb = new StringBuilder();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
sb.AppendLine(rdr["name"].ToString() + ' ' + rdr["lname"].ToString());
}
}
notifyIcon.BalloonTipText = sb.ToString();
notifyIcon.ShowBallonTip(30000);
from The MS notifyicon page,你需要知道如何執行sql命令嗎?
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = new Icon("appicon.ico");
// The ContextMenu property sets the menu that will
// appear when the systray icon is right clicked.
notifyIcon1.ContextMenu = this.contextMenu1;
// The Text property sets the text that will be displayed,
// in a tooltip, when the mouse hovers over the systray icon.
notifyIcon1.Text = SqlCommandResultsHere;
notifyIcon1.Visible = true;
// Handle the DoubleClick event to activate the form.
notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
謝謝,我不知道如何使用DataReader的,我不能使用的ExecuteScalar因爲我的輸出是名字,LNAME,我想我應該谷歌如何使用DataReader的 – Arash
感謝,現在我想知道如果我有兩個記錄的名稱和lname我應該如何顯示他們?例如在ballontiptext我想顯示:alex a,fred b – Arash
@arash另一個更新。 – LarsTech