Why am i getting "SQL Server does not exist or access denied" error
Reply
![]() |
|
From:
![]() naarumanchi
|
Hi i am vidyakumar
I am working on C# and ASP.NET.
While binding the data to a grid i am getting a strange runtime error
ie; SQL Server does not exist or access denied
eventhough my server is running and the connection string is correct the problem still persists i tried all the possable ways but i failed.
I Am sending the coad as well as the error message please help me in this matter.
Here the CODE:- ----------------------------------------------------------------------------------------------------------------------------------------
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Data.OleDb; namespace Employee { /// <summary> /// Summary description for Worksetup1. /// </summary> public class Worksetup1 : System.Web.UI.Page { protected System.Web.UI.WebControls.DataGrid gridworksetup; protected System.Web.UI.HtmlControls.HtmlInputButton btnAdd; protected System.Web.UI.HtmlControls.HtmlInputButton btnEdit; protected System.Web.UI.HtmlControls.HtmlInputButton btnDelete; protected System.Web.UI.HtmlControls.HtmlInputHidden txtFullHid; SqlConnection con;
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here
// Put user code to initialize the page here /*DataView dvResult = (DataView)CreateDataSource(); gridworksetup.DataSource = dvResult; gridworksetup.DataBind(); */ Worksetup();
}
public void Worksetup() {
gridworksetup.DataSource = CreateDataSource(gridworksetup.CurrentPageIndex); gridworksetup.DataBind();
}
private SqlDataReader CreateDataSource(int nPageIndex) { SqlDataReader dr; // Page index is assumed to be 0-based int nPageSize = gridworksetup.PageSize; int nBaseProductID = nPageSize * nPageIndex;
// Set up the connection string connectionString = "[EMAIL PROTECTED];database=employeedetails;integrated security=true;uid=sa;pwd="; con = new SqlConnection(connectionString);
// Set up the command string SQLSelect; SQLSelect = "SELECT * FROM Worksetup_details "; SqlCommand cmd =new SqlCommand(SQLSelect,con);
// Execute the command con.Open(); dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); return dr; }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load);
} #endregion
private void gridworksetup_SelectedIndexChanged(object sender, System.EventArgs e) { /*con.Open(); string SQLSelect; SQLSelect = "SELECT * FROM Worksetup_details "; SqlCommand cmd =new SqlCommand(SQLSelect,con);
SqlDataReader dr = cmd.ExecuteReader(); dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); return dr; gridworksetup.DataSource = CreateDataSource(); gridworksetup.DataBind(); dr.Close(); */
}
} }
Here the error message:- -------------------------------------------------------------------------------------------------------------------------------------------
Server Error in '/Employee' Application. --------------------------------------------------------------------------------
SQL Server does not exist or access denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.
Source Error:
Line 65: Line 66: // Execute the command Line 67: con.Open(); Line 68: dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); Line 69: return dr;
Source File: d:\inetpub\wwwroot\employee\worksetup.aspx.cs Line: 67
Stack Trace:
[SqlException: SQL Server does not exist or access denied.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) System.Data.SqlClient.SqlConnection.Open() Employee.Worksetup1.CreateDataSource(Int32 nPageIndex) in d:\inetpub\wwwroot\employee\worksetup.aspx.cs:67 Employee.Worksetup1.Worksetup() in d:\inetpub\wwwroot\employee\worksetup.aspx.cs:43 Employee.Worksetup1.Page_Load(Object sender, EventArgs e) in d:\inetpub\wwwroot\employee\worksetup.aspx.cs:36 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain()
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 -------------------------------------------------------------------------------------------------------------------------------------------
My server name is "HAPPYHOM-576F99" and i used the Mixed mode for SqlServer Authentication.
Please help me
Its very urgent
please help me by providing a solution
Thanks in Advance
Regards Vidyakumar
_________________________________________________________________ A Camera Sells every 2 Minutes on eBay. Get Your's at a Great Price Now! http://adfarm.mediaplex.com/ad/ck/4686-26272-10936-699?ck=Cameras
|
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|
- Why am i getting "SQL Server does not exist or access den... naarumanchi
-