这个程序有什么地方出错吗???(timer不起作用)
大家帮忙看看,为什么我的程序只能运行一次,timer不起作用
------------------------------------------------------------------------
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void timer1_Tick(object sender, System.EventArgs e)
{
string connection = ConfigurationSettings.AppSettings["GetConncetion"].ToString();
string extno1 = ConfigurationSettings.AppSettings["extno1"].ToString();
string uid = ConfigurationSettings.AppSettings["uid"].ToString();
string pswd = ConfigurationSettings.AppSettings["pswd"].ToString();
SqlConnection myconnection = new SqlConnection(connection);
myconnection.Open();
string selectstring = "select top 2 * from TSMS where MobileNum between '130' and '133' order by MobileID";
SqlDataAdapter mycommand = new SqlDataAdapter(selectstring, myconnection);
DataTable dt = new DataTable();
mycommand.Fill(dt);
HttpWebResponse res = null;
for(int i=0;i<dt.Rows.Count;i++)
{
string strmsg = System.Web.HttpUtility.UrlEncode((string)dt.Rows[i]["Content"],System.Text.Encoding.GetEncoding("GB2312"));
string strmob = (string)dt.Rows[i]["MobileNum"];
string strUrl = "http://econnect.hotdotchina.com/econnect/pitf/submit.jsp?uid=" + uid + "&pswd=" + pswd + "&extno=" + extno1 + "&msg=" + strmsg + "&mob=" + strmob;
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strUrl);
res = (HttpWebResponse)req.GetResponse ();
}
}