You must Sign In to post a response.
  • Category: ASP.NET

    Error in connecting when using the web config file in asp.net using C#

    in .aspx code as follows

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {

    this.BindGrid();
    }
    }

    private void BindGrid()
    {
    string strConnString = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
    using (SqlConnection con = new SqlConnection(strConnString))
    {
    using (SqlCommand cmd = new SqlCommand())
    {
    cmd.CommandText ="select Tb_Employee";
    cmd.Connection = con;
    con.Open();
    gvEmpdetails.DataSource = cmd.ExecuteReader();
    gvEmpdetails.DataBind();
    con.Close();
    }
    }
    }

    When i run the application shows error as follows

    Keyword not supported: 'Mymachine\sqlserver2012; integrated security'

    please help me.

    what is the mistake in my above code
  • #765761
    Hi rao,

    I guess the problem is connection string, please recheck your connection string and if you have any doubts, generate the connection string either using Visual studio or sql server and use that connection string in your web config file.

    Refer below link, for more details how to generate the connection string using visual studio.
    http://www.c-sharpcorner.com/uploadfile/suthish_nair/how-to-generate-or-find-connection-string-from-visual-studio/

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments