Hi!
I have on my form one label (lblMsgSend) with the text "Sended". I need with these codes when there datas that already exist it cant show this label's message "Sended".
Right now when I click to my save's button (even it found datas already exist its show the label's message) . How can I do please.
conn.Open();
OleDbCommand comm = new OleDbCommand();
comm.Connection = conn;
connstr = "SELECT COUNT(*) FROM propTrans WHERE [nome] = @nome";
comm.CommandText = connstr;
comm.Parameters.Clear();
comm.Parameters.AddWithValue("@nome", cbxNomePropinas.Text);
comm.Parameters.AddWithValue("@tipopagamento", cbxTipoPagamentoPropinas.Text);
comm.Parameters.AddWithValue("@mes", cbxMesPropinas.Text);
int numRecords = (int)comm.ExecuteScalar();
if (numRecords == 0)
{
connstr = "INSERT INTO propTrans([nome],[tipopagamento],[mes])VALUES(@nome,@tipopagamento,@mes)";
comm.CommandText = connstr;
comm.Parameters.Clear();
comm.Parameters.AddWithValue("@nome", cbxNomePropinas.Text);
comm.Parameters.AddWithValue("@tipopagamento", cbxTipoPagamentoPropinas.Text);
comm.Parameters.AddWithValue("@mes", cbxMesPropinas.Text);
comm.ExecuteNonQuery();
conn.Close();
/////////////////////////////////////////////////////////////////////////////////
timer1.Start();
lblMsgSend.Visible = true;

ali tuncerRank #1,499 · 1.1K reputationPosted Mar 3, 2016, 7:34 PM EST
}
{
}
Amit KumarRank #459 · 5.4K reputationPosted Mar 3, 2016, 7:44 PM EST
Ravi PatelRank #439 · 5.7K reputationPosted Mar 3, 2016, 9:40 PM EST
IsraelRank #1,223 · 1.5K reputationPosted Mar 4, 2016, 2:12 AM EST
Thrish53 reputationPosted Mar 4, 2016, 5:19 AM EST
IsraelRank #1,223 · 1.5K reputationPosted Mar 4, 2016, 7:14 AM EST
Thrish53 reputationPosted Mar 4, 2016, 10:05 AM EST