Guys, i need to make a trigger for my table ([Print Record] table)..
This trigger will active when i print some data, and i need to get the people's name who print, date (now) , and time, and what he print..
here is some of my printing codes:
private void PrintDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
try
{
byte[] gambar = new byte[0];
gambar = (byte[])(dgv_ProductData.CurrentRow.Cells[5].Value);
MemoryStream ms = new MemoryStream(gambar);
Bitmap bm = new Bitmap(ms);
bm = ResizeBitmap(bm,225,300);
e.Graphics.DrawImage(bm, 0,0);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
try
{
byte[] gambarspec = new byte[0];
gambarspec = (byte[])(dgv_ProductData.CurrentRow.Cells[6].Value);
MemoryStream ms = new MemoryStream(gambarspec);
Bitmap bms = new Bitmap(ms);
bms = ResizeBitmap(bms,486,270);
e.Graphics.DrawImage(bms, 275, 0);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private static Bitmap ResizeBitmap(Bitmap sourceBMP, int panjang, int lebar)
{
Bitmap result = new Bitmap(panjang,lebar);
using (Graphics g = Graphics.FromImage(result)) g.DrawImage(sourceBMP, 0, 0, panjang, lebar);
return result;
}
private void btn_Print_Click(object sender, EventArgs e)
{
try
{
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
and i want to make the data was inserted into the table when i already press Print (not everytime i press btn_Print_Click, because there is a chance i abort to print)..