TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
699
1.3k
217.3k
I need to save with a simple condition
Mar 4 2016 12:00 AM
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;
Reply
Answers (
7
)
How to pass multiple parameter using json in mvc4?
How to prevent iframe postback on main page button click