Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
How to display the messagebox if Qty "Stock It Out" c #
Amrul Hakim
May 22 2017 1:31 PM
198
Reply
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();
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
ComboBox item will open a web link
class/textbox/loop