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
Amrul Hakim
NA
19
3.6k
How to display the messagebox if Qty "Stock It Out" c #
May 22 2017 1:31 PM
this my database Sql Server mines Qty
this my code C#
private
void
btn_proses_Click(
object
sender, EventArgs e)
{
conn = Koneksi.Conn;
try
{
conn.Open();
cmd =
new
SqlCommand(
"INSERT INTO Tb_Transaksi VALUES ('"
+ txt_KodeTransaksi.Text +
"', '"
+ cm_pilihBarang.SelectedItem.ToString() +
"', '"
+ txt_jumlah.Text +
"', '"
+ Datepicker1.Value.Date.ToString(
"M/d/yyyy"
) +
"', '"
+ cm_select.SelectedItem.ToString() +
"', '"
+ txt_mengetahui.Text +
"', '"
+ txt_diketahui.Text +
"', '"
+ txt_keterangan.Text +
"', '"
+ cm_status.SelectedItem.ToString() +
"' )"
, conn);
cmd.ExecuteNonQuery();
if
(cm_status.SelectedItem.ToString() ==
"Keluar"
)
{
cmd =
new
SqlCommand(
"UPDATE Tb_Barang SET Qty=Qty - '"
+txt_jumlah.Text +
"' WHERE Nama_Barang= '"
+ cm_pilihBarang.SelectedItem.ToString() +
"'"
, conn);
cmd.ExecuteNonQuery();
}
if
(cm_status.SelectedItem.ToString() ==
"Masuk"
)
{
cmd =
new
SqlCommand(
"UPDATE Tb_Barang SET Qty=Qty + '"
+ txt_jumlah.Text +
"' WHERE Nama_Barang= '"
+ cm_pilihBarang.SelectedItem.ToString() +
"'"
, conn);
cmd.ExecuteNonQuery();
}
MessageBox.Show(
"Data Telah Masuk"
);
}
catch
(Exception ex)
{
MessageBox.Show(
"Erorr"
, ex.Message);
}
finally
{
autokode_transaksi();
conn.Close();
Datagrid_Transaksi();
}
}
Reply
Answers (
3
)
ComboBox item will open a web link
class/textbox/loop