-2
我已經構建了一個項目,員工在其中刷卡並將其保存到數據庫中。 我有一個文本框名稱txtSwipe,其中員工TAG ID正在顯示,其他進程(如Progressbar和不同類型的消息)都與該txtSwipe相關聯。我在txtSwipe的鼠標點擊事件上編寫了代碼。不在文本框中顯示標籤ID
現在當員工刷卡他/她的卡我不希望該標籤ID顯示給用戶也在這個點擊事件只有數據正確保存到數據庫,如果我張貼代碼在文本更改事件或任何其他數據沒有正確保存。我使用
代碼是在這裏:
try
{
this.Cursor = Cursors.WaitCursor;
label1.Text = "Working...";
Application.DoEvents();
con = new SqlConnection(str);
con.Open();
SqlCommand cmd = new SqlCommand("Insert into Datatab(rfid)values(@rfid)", con);
cmd.Parameters.AddWithValue("@rfid", txtSwipe.Text);
cmd.ExecuteNonQuery();
con.Close();
txtSwipe.ResetText();
label1.Text = "Done";
}
catch (Exception ex)
{
label1.Text = "Error";
MessageBox.Show(ex.Message);
}
finally
{
this.Cursor = Cursors.Default;
}
int i;
progressBar1.Minimum = 0;
progressBar1.Maximum = 200;
for (i = 0; i <= 200; i++)
{
progressBar1.Value = i;
}
在哪裏是'tag'? –
rfid是顯示在我不想顯示的文本框中的標記。 –
看不到rfid被設置爲任何文本框。 –