c# – Multiple SQL Server statements do not work on same form

I am working on a C# project with a Microsoft SQL Server database.

This is how I have connected the database:

DataSet ds_display = new DataSet();

SqlDataAdapter da_display = new SqlDataAdapter("Select * from Files", "Data Source=DESKTOP-21EVLOU\SQLEXPRESS;Initial Catalog=UPM;Integrated Security=True");
da_display.Fill(ds_display, "Files");

dataGridView1.DataSource = ds_display.Tables["Files"].DefaultView;

The code works fine for all operations including reading data, writing data, updating data and deleting data as well. However, it works only when each operation is on individual form, not on a single form.

I have created several different panels and show/hide them based on the respective button. Each panel has its own operation and Data Grid View. The display option works fine but the addition, updating and deleting operations do nothing.

Can you please help identify the issue here?

Source link

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top