代码如下:
private void textBox1_TextChanged(object sender, EventArgs e)
{
keko.Open();
MySqlCommand cmd = new MySqlCommand("Select * from giris_cikis where RFID='" + textBox1.Text + "' AND Tarih='" + DateTime.Now.ToShortDateString() + "'", keko);
MySqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
if (dr["Cikis"].ToString() == "")
{
keko.Close();
keko.Open();
MySqlCommand kmt = new MySqlCommand("Update giris_cikis set Cikis='" + DateTime.Now.ToShortTimeString() + "' where RFID='" + textBox1.Text + "' AND Tarih='" + DateTime.Now.ToShortDateString() + "'", keko);
kmt.ExecuteNonQuery();
}
else
{
MessageBox.Show("Zaten çıkış yaptınız!");
}
}
else
{
keko.Close();
keko.Open();
MySqlCommand ara = new MySqlCommand("Select * from rfid where rfid='" + textBox1.Text + "'", keko);
MySqlDataReader arad = ara.ExecuteReader();
if (arad.Read())
{
string a = arad["Adi"].ToString();
string b = arad["Soyadi"].ToString();
keko.Close();
keko.Open();
MySqlCommand kmt = new MySqlCommand("Insert into giris_cikis (Adi,Soyadi,Tarih,Giris,RFID) values ('" + a + "','" + b + "','" + DateTime.Now.ToShortDateString() + "','" + DateTime.Now.ToShortTimeString() + "','" + textBox1.Text + "')", keko);
kmt.ExecuteNonQuery();
}
}
keko.Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
textBox1.Text = serialPort1.ReadLine();
}
当我调试这个,调试窗口冻结我应该怎么做?
有人认识阿杜尼奥吗?如果你愿意,我可以给你arduino密码。
我想做一个自动化系统,但不起作用。
有一个计时器,当它滴答作响时间隔1500 textbox1.text = serialport1.readline();
但它冻结了。 Serialport
在中打开 form1_load
.
暂无答案!
目前还没有任何答案,快来回答吧!