When run my code then show this error message "Error :The name 'ConfigurationManager' does not exist in the current context."
How to solve this error?
Code:
using System;using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Configuration.Assemblies;
using System.Configuration;
namespace practice
{
public partial class info : Form
{
public info()
{
InitializeComponent();
}
private void btn_save_Click(object sender, EventArgs e)
{
string constr = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
SqlConnection Con =new SqlConnection(constr);
Con.Open();
SqlCommand cmd =new SqlCommand();
cmd.Connection=Con;
cmd.CommandType=CommandType.Text;
cmd.CommandText="insert into info values('txt_name.Text+','+txt_mail.Text') ";
int i=cmd.ExecuteNonQuery();
if(i>0)
{
MessageBox.Show("Data save successfully");
}
else
{
MessageBox.Show("failed");
}
}
}
}