c# - Getting Error while read the data from table -


I am displaying all the data from the database table in Gridview. I have attached the database file to the app folder but when I am running the application, I am getting the error like

Login can not open the database requested in the 'Employee' login fails User 'HOME-47F64BE31D \ Administrator'

Here's my complete code:

aspx page:

  & lt; ASP: Gridview id = "Gridview 1" runat = "server" Autogrentech column = "Fotal" & gt; & Lt; Columns & gt; & Lt; ASP: BoundfieldDefined = "Firstname" header text = "Firstname" /> & Lt; ASP: BoundfieldDefined = "Last name" header text = "last name" /> & Lt; ASP: BoundfieldDefined = "Hiredate" header text = "Hiredate" /> & Lt; / Column & gt; & Lt; / ASP: GridView & gt; & Lt; Asp: label id = "lblStatus" runat = "server" & gt; & Lt; / Asp: label & gt;  

aspx.cs:

  protected void Pej_lod (object sender, Iventaarjis e) {if (! IsPostBack) GetData (); } Private Zero GetData () {string str = ConfigurationManager.ConnectionStrings ["ConnectionString"]. ConnectionString; SqlDataAdapter da = New SqlDataAdapter ("GetEmp", str); Da.SelectCommand.CommandType = CommandType.StoredProcedure; Dataset ds = new dataset (); Da.Fill (DS); GridView1.DataSource = DS; GridView1.DataBind (); }  

Please help me what is the error?

Your error actually looks like: database access error that HOME-47F64BE31D \ Administrator < / code> the user does not have access to your database, you have two options:

  • for the user to access their database you define through its SQL Management Studio that allow can do.
  • To notify a user with permission in your query string;

With a user with permission User ID = aaa; To add password = BBB , edit your configuration file, in the form of a side note, you will see the sa user in your application


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -