Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i already have my access database document so what i want is to to bring the acc

ID: 3926324 • Letter: I

Question

i already have my access database document so what i want is to to bring the access database in c# and create 3 buttons Save, Delete ,and Search, and a text box that i am going to type what i am going to search, and make a chart next to it showing the summary report of my access database document . so basically what i want is whenever i save something or delete something in visual studio it gets saved directly to my access database document or or gets deleted from it so that when i go to my access database document it is deleted there .And for the chart , i have a summary report in my access database document so i want that to appear on the char .
here is how i want it to look:



Fnd Symbol Re

Explanation / Answer

Answer :-

Steps :-

Step 1 ) First open visual studio and we can create one windows project .

Step 2) open App.config and write connection string.

<connectionStrings>

<add name="dbconnection" connectionString="Data ource=servername;uid=exampleuserid;

Password=examplepassword;database=Hospital" providerName="System.Data.SqlClient" />

</connectionStrings>

Step 3) write c# code in your codebehind add this two name spaces.

using System.Data.SqlClient;
using System.Configuration;

Step 4) write c# code in your codebehind connectin string.

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString);

Step 5) double click on save buttion and we can write c# code in codebehind .cs file.

private void save_Click(object sender, EventArgs e)
{
  

string s = "insert into tablename values('" + textboxid1.Text + "','" + textboxid2.Text + "','" + textboxid3.Text + "')";
SqlCommand cmd = new SqlCommand(s, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Save Data Successfully.............!");
}

Step 6) double click on delete buttion and we can write c# code in codebehind .cs file.

private void delete_Click(object sender, EventArgs e)
{
  
string s = "delete tablename where ID=@id";
SqlCommand cmd = new SqlCommand(s, con);
con.Open();
cmd.Parameters.AddWithValue("@id",ID);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("delete data...................!");
}

Step 7) double click on search buttion and we can write c# code in codebehind .cs file.

private void search_Click(object sender, EventArgs e)
{
BindingSource bs = new BindingSource();
bs.DataSource = dataGridView1.DataSource;
bs.Filter = "searchname like '*" + searchtextboxid.Text + "*'";
dataGridView1.DataSource = bs;
}