Home » c# » c# – System.InvalidOperationException: Instance failure

c# – System.InvalidOperationException: Instance failure

Posted by: admin February 21, 2020 Leave a comment

Questions:

Im currently creating a datatable then suddenly these occur.

sqlCon.Open(); // this is the error when running the program

protected void Page_Load(object sender, EventArgs e)
{
    using (SqlConnection sqlCon = new SqlConnection(connectionString))
    {
        sqlCon.Open();
        SqlDataAdapter sqlDa = new SqlDataAdapter("Select * From TACLC", sqlCon);
        DataTable dtbl = new DataTable();
        sqlDa.Fill(dtbl);
        GridView1.DataSource = dtbl;
        GridView1.DataBind();
    }
How to&Answers: