𝕏
❔ need help , data will not save when I select pdf to upload
save button
browse button
btnSave
tblReports
CREATE TABLE [dbo].[tblreports] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[p_name] VARCHAR (50) NULL,
[test] VARCHAR (50) NULL,
[chargers] VARCHAR (50) NULL,
[report] VARBINARY (MAX) NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
C#
private void btnAddnew_Click(object sender, EventArgs e)
{
try
{
//add new report
HCDBAppData.tblreports.AddtblreportsRow(HCDBAppData.tblreports.NewtblreportsRow());
tblreportsBindingSource.MoveLast();
comboBox1.Focus();
C#
private void btnAddnew_Click(object sender, EventArgs e)
{
try
{
//add new report
HCDBAppData.tblreports.AddtblreportsRow(HCDBAppData.tblreports.NewtblreportsRow());
tblreportsBindingSource.MoveLast();
comboBox1.Focus();
C#
try
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "PDF Files|*.pdf";
openFileDialog.Title = "Select a PDF File";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string pdfFilePath = openFileDialog.FileName;
string fileName = Path.GetFileName(pdfFilePath);
// Display the selected file path in a TextBox or label
txtFileName.Text = fileName;
C#
try
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "PDF Files|*.pdf";
openFileDialog.Title = "Select a PDF File";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string pdfFilePath = openFileDialog.FileName;
string fileName = Path.GetFileName(pdfFilePath);
// Display the selected file path in a TextBox or label
txtFileName.Text = fileName;
C#
private void btnSave_Click(object sender, EventArgs e)
{
try
{
//save new report
tblreportsBindingSource.EndEdit();
int rowsAffected = tblreportsTableAdapter.Update(HCDBAppData.tblreports);
if (rowsAffected > 0)
{
HCDBAppData.AcceptChanges();
dataGridView9.Refresh();
MessageBox.Show("Report successfully uploaded", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
C#
private void btnSave_Click(object sender, EventArgs e)
{
try
{
//save new report
tblreportsBindingSource.EndEdit();
int rowsAffected = tblreportsTableAdapter.Update(HCDBAppData.tblreports);
if (rowsAffected > 0)
{
HCDBAppData.AcceptChanges();
dataGridView9.Refresh();
MessageBox.Show("Report successfully uploaded", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
5 replies