I'm trying to get webparts working with an sql 2000 database. I managed to get a database up and running using the aspnet_regsql.exe utility, enable forms authentiation, and user registration using asp 2.0 controls. Despite this success I seem to be getting a connection error when I try to display any page that has a web parts control. My thought is I need to specify a connection in the web part manager or some file other then the web.config.
Here's the error I get when I attemp to display a page with a webpart.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
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.
SQLExpress database file auto-creation error: The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database: If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist. If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database. Sql Server Express must be installed on the machine. The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: [SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734947 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +130 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +68 [HttpException (0x80004005): Unable to connect to SQL Server database.] System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +124 System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +86 System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +25 System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +397 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
The error message really confuses me. It seems to indicate that I'm trying to use SQL Express when I'm not. My only thought is the webpart manager doesn't know about the sql connection that has been established for the web application.
Since the applicaiton is connection for user authentication / creation using ASP2.0 controls I figured remote connections have been allowed for the server.
If anyone has any links to an example maybe I can mimic thier sample and resolve my problem.
I just installed a fresh lab machine with WSS 3.0 and SQL 2005. I registered the RS web parts.
In the home page I added the Reports Explorer and the Report viewer web parts. I set up the Reports Explorer and the list of reports are showed.
When I connect the Report Viewer Web part to get report from the Report Explorer web part I get the maintenance WSS page. I have to delete the Report Viewer web part to have the page working again.
If I use only the Reports Viewer with a report (not connected to Reports Explorer) is working just fine.
Any ideas what could be the problem? Any hints on how to investigate this is also much appreciated.
hi alliam trying to build an asp.net webpart site, i donot want to use SQL Server Express for it, rathar than that i planned to use an sql server 2000 database , so far after doing this my pages is getting me this errorAn error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)where i surprise because i tell it in web.config to use my profile rathar than this default one, can any one tell me the secret behind thatRegards,
"...Sharepoint sees the Report Viewer Web Part as a single item and will continually rename it sequentially as Report Viewer [x].... This is a limitation of SharePoint..." http://books.google.com/books?id=b0dXlx5aww8C&pg=PA314&lpg=PA314&dq=report+viewer+web+part+title&source=web&ots=U0MVGHySWU&sig=pGBgHh2gXYWcpuZMqttY7S9B65c&hl=en
If this is true then it applies also to the ReportExplorer webpart. Is there a current fix for SharePoint? Or is there a current fix for the webParts?
I can see customers complaining that they would like to see on their SharePoint ReportExplorer WebParts pointing to separate environments (SSRS) and multiple ReportViewer webparts pointing to different reports. Which would result in ReportExplorer [1], ReportExplorer [2],....ReportExplorer [x] and ReportViewer [1], ReportViewer [2],....ReportViewer [x].
Instructing customer's to ignore webpart title's and look at report names is NOT going to be acceptable. Especially since other webparts within Sharepoint behave differently.
Does anyone know the location of Microsoft.ReportingServices.SharePoint.UI.WebParts.dll after you install the web part? I am wondering if I can inherit from this web part to wrap some other functionality into it. I know that i see it in the GAC buyt can't seem to find it so I can look at the assembly using reflector.
Also, how easy is it to pass in parameters to the Report Viewer?
I just installed a fresh lab machine with WSS 3.0 and SQL 2005 SP1. I registered the RS web parts.
In the home page I added the Reports Explorer and the Report viewer web parts. I set up the Reports Explorer and the list of reports are showed.
When I connect the Report Viewer Web part to get report from the Report Explorer web part I get the maintenance WSS page. I have to delete the Report Viewer web part to have the page working again.
If I use only the Reports Viewer with a report (not connected to Reports Explorer) is working just fine.
Any ideas what could be the problem? Any hints on how to investigate this is also much appreciated.
hi i am getting error while connecting to sql server in c# 2005. error is :An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) I don't why this error occured???? Anybody's help would be highly appreciatedTushar
Does SQL server 2000 always use TCP/IP and port 1433 to make connections?
More details related to the above question: I've got MSSQL server 2000 running and we have a firewall. When I'm testing locally on the server I can telnet to localhost on 1433 and connect. However, when I'm testing remotely, I cannot connect on port 1433. However I can make a Query Analyzer connection remotely. !?!?!???
The reason why I'm asking this is I'm trying to set up a Linux connection to MSSQL using FreeTDS.
im in the begginging stages of converting an access 2003 backend to SQL 2003sp3.
The access's upgrade wizzard did an ok job getting most of the tables ported over. Now when the frontend relinked the tables to SQL server im assuming i just continue on using them as is. When the wizzard wanted a connection to use i created a new connection and saved it on the server. Im assuming this connection object is what access is using to get to SQL.
Am i assuming correctly ?
The reason i ask is only a few of the linked tables in to sql seem to be editable. some are read only ? (i have primary keys in all my tables.) im just calling a query bound to the linked tables.
Secondly, But could be related.
Now this problem i dont understand. On open of my main form i log who and what pc they are using. in this situation i open a record set, log the data and close it. At first the error was i needed to add dbSeeChanges on my object, ok so i added it as an option.
But i now get an the error message: at rsTran.AddNew "Run Time error: 3027 , Can Not update. Database or Object is read Only ?
here is the code
Set db = CurrentDb Set rsTran = db.OpenRecordset("tblUserLog", dbOpenDynaset, dbSeeChanges) struser = Currentuser strNetwork = atCNames(1) strPC = atCNames(2)
I am trying to install Sql Server 2000 at the moment but when i try to connect to local Windows NT server i get this messege http://img293.imageshack.us/img293/3263/connection8rq.jpg and if i go to properties of the server i get http://img369.imageshack.us/img369/1335/properties9dd.jpg. I believe it is trying to log in using my Windows Authications.
I'm trying to connect to an SQL server 2000 database table from my PDA using VB.NET through a bluetooth connection. I keep getting an error telling me that I cannot connect. I have tried everything that I can think of to fix it.
Do I need a copy of SQL Server CE on the PDA, even though I'm only viewing data from my PC's database on my PDA?
Moderated by XIII, please use a normal font size for better readability: for some reason, my web application can not connect to my SQL 2000
my application is based on .net 2.0 (IIS 5.1) using vs 2005 workstation does not install any sql server sql 2000 locates at the remote server. the sql server can be connected via vs environment (data connnection), therefore, i think the connection string, server name and instance name is correct i have tried all the solution i can find online, but it is not working LocalSQLServer connection string has been removed in GobalSetting also remove all default connection string in web.config (<clear />) aspnet_regsql can register the sql 2000 db successful vs 2005 can access and display the data in sql 2000 quite well has been reboot lots of times. still bug out any body have any idea? thanks, it already costs me the whole day An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I am trying to make a simple connection to my sql server, but am getting an error. I am not sure why it says SQL Server 2005 in the error as we use 2000. I have found others to have the problem on the web, but have found no answers. One person said the sql connection worked when he downgraded to 1.1; however, I'd like to avoid that. Here is my code:
<%@Import Namespace="System.Data.SqlClient" %> <script runat="server"> Sub Page_Load() Dim conNorthwind As SqlConnection
conNorthwind = New SqlConnection("Server=1CDRSRV4; uid=username; pwd=password; database=Northwind") conNorthwind.Open() End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> Connection Opened! </body> </html>
here is my error:
Server Error in '/' Application.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)Source Error:
Line 6: Line 7: conNorthwind = New SqlConnection("Server=1CDRSRV4; uid=sa; pwd=sa; database=Northwind") Line 8: conNorthwind.Open() Line 9: End Sub Line 10: </script>Source File: C:Inetpubwwwrootchap2sqlconnection.aspx Line: 8 Stack Trace:
[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734995 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 ASP.chap2_sqlconnection_aspx.Page_Load() in C:Inetpubwwwrootchap2sqlconnection.aspx:8 System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) +5 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +783999 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
i'm using sql server 2005 express edition as the database server for my web application. Right now, i want to deploy it and the problem is, my hosting is using sql server 2000. So, is it possible to deploy my database that has been created in sql server 2005 in the sql server 2000? I'm afraid that the connection string for sql server 2000 is different from sql server 2005. In addition, i'm using forms authentication in my web application. So, some data regarding to the forms authentication like dbo.asp_net.membership table, dbo.asp_net.roles table is in my database. Is it the table that has been created like dbo.asp_net.membership can be used in sql server 2000 since it is created by asp.net forms authentication function?
Hi all, I am trying to trouble shoot this database VS 2003 web application I have. I cannot connect to the database on the server through the VS program. However, I can connect to the server database via Enterprise Manager on my machine. Also, I am able to connect my VS 2003 program to a replicated database on my local machine, it connects without a problem. So, I am assuming there is a setting that is not right on the server machine. I am running SQL Server 2000. But, I am getting this error below which seems to apply more to Server 2003. Any ideas? Thanks! An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735251 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Web.SessionState.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo) +79
Has anyone ever encountered problems making .Net applications connect to a SQL database on SQL 2000 with SP3a?
It's running on a virtual machine with a Windows Server 2000 Std with SP4, the .Net application is working with .Net Framework 1.1.4322.573. For some reason it can't connect to the SQL database using the specified username and password in the web.config file even though the user exists in the SQL database. I've tried using the SA password but this still doesn't work. I can logon to SQL Query Analyzer using the SA password but not using the other username.
The .Net application does work on other systems of mine all of which can run on Windows Server 2000 and 2003, I have compared them but can't find any differences.
I have asp code that uses C# to create a SQL connection and a command. Then I create a data set and fill the data set using my comand. Finally I bind my data set to a data grid named myDataGrid. I am not sure where myDataGrid comes from since it is never defined. Where does myDataGrid come from? Also, I believe that I do not need to call page_Load since auto wire is set to true by default so it is my understanding that this method page_Load will be called by default.void page_load(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection("server='(local)'; trusted_connection=true; database='mattsDEMO'"); SqlDataAdapter myCommand = new SqlDataAdapter("select * from people", myConnection); DataSet ds = new DataSet(); myCommand.Fill(ds, "people"); MyDataGrid.DataSource=ds.Tables["people"].DefaultView; MyDataGrid.DataBind(); }
When I place a data grid controll on my page named myDataGrid, I do not see a data grid and there is no data either. The code in the HTML looks like this:
<body> <form runat="server"> <p> <asp:DataGrid id="myDataGrid" runat="server" BorderColor="Maroon"></asp:DataGrid> </p> </form></body>I tried using debug that comes with the .Net framework (since I am using Web Matrix) but I get an error saying no symbols were found for this document when setting break points. What are symbols and why do I need them?So, I basically have four (4) important questions that I need help answering: 1) Why do I not have any data in my data grid? 2) Where did myDataGrid come from? 3) Is the page_Load method called by default if auto wire is set to true or not declared? 4) Why do I need symbols for debug?Below is all my code in one complete view:<%@ Page Language="C#" %><%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %><%@ import Namespace="System.Data" %><%@ import Namespace="System.Data.SqlClient" %><script runat="server"> // Insert page code here // </script><html><head> <script language="C#">void page_load(object sender, EventArgs e){SqlConnection myConnection = new SqlConnection("server='(local)'; trusted_connection=true; database='mattsDEMO'");SqlDataAdapter myCommand = new SqlDataAdapter("select * from people", myConnection); DataSet ds = new DataSet();myCommand.Fill(ds, "people"); MyDataGrid.DataSource=ds.Tables["people"].DefaultView;MyDataGrid.DataBind();} </script></head><body> <form runat="server"> <p> </p> <p> <asp:Label id="Label1" runat="server">This is a test!</asp:Label> </p> <p> <asp:DataGrid id="myDataGrid" runat="server" BorderColor="Maroon"></asp:DataGrid> </p> </form></body></html>Thanks,Ryan
For nearly 6 wks I have been trying to workout with GoDaddy.com a connection string that will connect to the SQL Server 2000 from my ASP.Net web application. In my programming, I have placed the connection string in the web.config file and then call it from there within code behind using the SQLConnection object. My web.config entry has the following form: <appSettings> <add key="Conn" value="server=GoDaddyserver;integrated security=SSPI;database=databaseonGoDaddyserver;" /> </appSettings>I have also written the key supplying the UID and pwd. Nothing works and their support is of no help.Has anyone else had this difficulty either in general or with GoDaddy in particular?
I am using asp.net 2.0, and am attempting to connect to a SQL Server 2000 database. When I run the web page either in the debugger, or by viewing it in the browser, I get the following error message:
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
I think that maybe my values for uid, and pwd are not correct? If this is the problem, then I don’t know what their values should be? Should uid always be equal to sa ??(If so why?)
Also I don’t know what the password should be. I don’t know what the name of the password as it was assigned over two years ago when I installed sql server 2000. I might need some instructions on how to find this value in SQL server.
Someone please help me if you can. Here is a snippet of the code I am using:
String sqlStmt = "INSERT INTO LogIn (UserName,PassWord) VALUES ('JohnyRocket','FastestRocket99')";
SqlConnection sqlConn = new SqlConnection("server=localhost;uid=sa;pwd=;database=MyWebSite;"); SqlCommand sqlCmd = new SqlCommand(sqlStmt, sqlConn); sqlConn.Open();
I'm developing an intranet site in ASP.NET 2.0 but I can't seem to connect to the DB from within my code. I've created a .vb class that houses a private Connection() that other functions within the class can call to connect to the database. In the calling function, I've declared my connection object and called the "Open" method on the object. However, when I attempt to execute the stored procedure command by calling the "ExecuteScalar" method, I get the following error: "ExecuteScalar requires an open and available Connection. The connection's current state is closed." Here's the code from my class: Imports System.Data Imports System.Data.SqlClient Namespace Encompass Public Class EncompassSecurity Public Shared Function GetHRIDByNTUserID(ByVal strNTUserID) As String Dim strHRID As String 'Create command object Dim cmd As New SqlCommand("usp_Get_HRID_By_NTUserID", Connection()) cmd.CommandType = CommandType.StoredProcedure 'Open DB connection Dim DBConnection As SqlConnection = Connection() DBConnection.Open() 'Input parameters Dim inNTUserParam As New SqlParameter("@NT_UserID", SqlDbType.VarChar) inNTUserParam.Direction = ParameterDirection.Input inNTUserParam.Value = strNTUserID cmd.Parameters.Add(inNTUserParam) 'Output parameters Dim outHRIDParam As New SqlParameter("@HRID", SqlDbType.Int) outHRIDParam.Direction = ParameterDirection.Output cmd.Parameters.Add(outHRIDParam) 'Run stored procedure strHRID = cmd.ExecuteScalar() Return (strHRID) 'Close DB connection DBConnection.Close() End Function Private Shared Function Connection() As SqlConnection Dim strConnectionString As String strConnectionString = ConfigurationManager.ConnectionStrings("Conn").ConnectionString Return New SqlConnection(strConnectionString) End Function End Class End Namespace Here's the code from my web.config file: <?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in WindowsMicrosoft.NetFrameworkv2.xConfig --> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <connectionStrings> <add name="Conn" connectionString="Data Source=ServerName;Initial Catalog=NPASDV;uid=UserName;password=*******;" providerName="System.Data.SqlClient" /> </connectionStrings>
<system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. Visual Basic options: Set strict="true" to disallow all data type conversions where data loss can occur. Set explicit="true" to force declaration of all variables. --> <roleManager defaultProvider="AspNetWindowsTokenRoleProvider" /> <compilation debug="true" strict="false" explicit="true" /> <pages> <namespaces> <clear /> <add namespace="System" /> <add namespace="System.Collections" /> <add namespace="System.Collections.Specialized" /> <add namespace="System.Configuration" /> <add namespace="System.Text" /> <add namespace="System.Text.RegularExpressions" /> <add namespace="System.Web" /> <add namespace="System.Web.Caching" /> <add namespace="System.Web.SessionState" /> <add namespace="System.Web.Security" /> <add namespace="System.Web.Profile" /> <add namespace="System.Web.UI" /> <add namespace="System.Web.UI.WebControls" /> <add namespace="System.Web.UI.WebControls.WebParts" /> <add namespace="System.Web.UI.HtmlControls" /> </namespaces> </pages> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" />
<!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> </system.web> </configuration> What am I doing wrong? Any help would be most appreciated!! Manuel
Hello All,I am working in vwd using C#. In my web develpent I am Connecting to the Sql server 2000's pubs table and displaying result in GridView Control.My Coding is SqlConnection con = new SqlConnection("Server=local host;uid=sa;pwd=**secret**;database=pubs"); string str = "select * from authors"; SqlDataAdapter da = new SqlDataAdapter(str, con); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind();his is a very simple Code.Now I got a error which isAn error has occurred while establishing a connection to the server.When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settingsSQL Server does not allow remote connections.(provider: Named Pipes Provider, error: 40 - Could not open aconnection to SQL Server)Can you tell me what is the problem hererajkumar sharma
Please tell me how to connect sql server and ASP in IIS 6.0.Earlier in IIS 5 I have connected in SQL server with ASP with DSN connection,the same global.asa file is not working in IIS6.0.But Asp pages are not giving any error ,but they are no just taking value from Database.I mean server connection is not establishing..
I have installed windows 2000 with service pack 4 and SQL 2000 server with service pack 2 on the same machine. Connection the sql server using windows authentication. Able to open SQL enterprise manager and query analyser using windows authentication. But if try to connect thru ASP page using the following connection string.
set conn=server.createobject("ADODB.Connection")
cs="Provider=SQLOLEDB;Persist security info=False; user id=sa; password=; Initial Catalog=TESTING;Data source=TEST;"
conn.open cs
The following error message is displayed.
Microsoft OLEDB Provider for SQL Server (80004005) [DBNETLIB] Connection open(Connect()).] SQL Server does not exist or access denied.
Do i have change any settings or change the connection string.
hi how could i create my own server connection in sql 2000.i have a problem because everytime i make a new server registration it always tell that it does not exist and access denied.pls help me.
Hi group,being pretty new to setting up sql server, I am stuck. Have installed sql 2000 server on Win 2000 server, IIS 5.0. I try to connect via ASP script that looks like this:<%Set Conn = Server.CreateObject("ADODB.Connection")ConStr = "PROVIDER=SQLOLEDB; DATA SOURCE=192.168.1.99"ConStr = ConStr & ";UID=someUser;PWD=somePassword" ConStr = ConStr & ";initial catalog=myDatabaseName;network library=DBMSSOCN"Conn.Open ConStrConn.CloseSet Conn = Nothing%>The IP number is the webserver my router points to on port 80.But get an HTTP 500 error and "The page cannot be displayed"Any suggestions as to what I am doing wrong here, would be very much appreciated.I have run applications for a long time that operate Access databases, but starting a new, an big project, forces me to upgrade to sql databases.Best wishesFCH
I am trying to connect to a sql server database from enterprisemanager. I am using sql server authentication and have set the SQLServer up to accept mixed mode authentication. I am still get themessage : Login failed for xxx. Reason not associated with a trustedsql server connection.
My aspx page is trying to connect to a remote server with SQL Server 2000 installed on it, the ip of the server is 172.16.3.111 and the same is the instance of SQL Server, sql server is running in SQL Server Authentication mode, user id is "test" and password is "test123", name of database is myDB,the connection string which I am providing is as follows:
At last I tryed with the combination of ip address and sql server instance name in the datasource but still getting the same exceptions.
Can u please tell whats the problem,is the connection string correct,the DBA has also registered me "test" as a user on the SQL server.One thing which I want to mention is that through enterprise manager I can connect and use sql server without any problems,also please note that in VS.NET when I try connecting using server explorer and test the connection than I connect successfully, than why is problem occuring in connecting throug aspx page.
Please reply soon because I am very much confused and totally unable to resolve the problem.
Hello Everyone The my PC's address is 10.0.0.X, and I want to connect with a Sql Server 2000 default Instance That have the address 192.168.1.X
I have modified the TCP port of Sql Server 2000 in 1453, instead 1433.
In my PC I have modified cliconfig and in Sql Native Client configuration, setting the client TCP port to 1453. Using the old Enterprise manager is possible to connect to Sql Server; instead using Sql Server Management studio doesn't work !
Well its always developer vs administrators, and for the life of me why wont they listen...? However now I must and hopefully someone can help. My need for this resolve is not to change the software which works, but to enlighten the administrators as to possible NOD32 conflicts, or perhaps another issue which I've missed.
In the following scenario I am stumped, and have never heard of anything like it.
The server (DNS (win2003) & sql 2000 sp3) has NOD32 enterprise running, my apps have been running on this environment for the last 3 years, however, for the last year and since NOD32 has been installed, a few very strange incidents have occurred.
1. Whenever this error occurs, users fail to connect to SQL server, the server connection string has to be altered from either server name to the server IP or vice versa. This is an intermittent occurance and can be anything from a few days to a few weeks between occurances.
To limit connectivity issues to a particular protocol, SQL only uses tcp/ip on port 1433. LMhost dont resolve any of these issues either.
2. Twice since the NOD32 installation (I do hope I am not blaming them unneccessarily) SQL communications has degraded over a period of time till a complete halt, (By degraded I mean point 1 above becomes more and more repetitive).
What I found is that when local network users no longer function, my terminal services users were still operational, the local network users could'nt comunicate via native drivers or odbc. In other words the drivers were functional in local only environment. The data server resides behind the linux firewall hence no port blocking is setup of the data sever.
My solution was to reinstall sp3, however does not explain the above errors,
If I am missing something, pray do tell, customer blames administrator, administrator blames me, I gotta blame someone or offer a solution cos hell knows no administrator is ever at fault.
In advance, excuse the digs if you're an administrator and many thanks
An application vendor is telling me that their product will not run with SQL Server 2000 64-bit. Here is the layout: * Dedicated 64-bit machine running Windows Server 2003 Enterprise, 64-bit. * Separate application server running Windows Server 2003 - SBS. Application server uses DCOM and OLEDB to obtain data from SQL Server.
My question: Is there any way for the application server to know if the data supplier is running 32-bit or 64-bit? If so, then perhaps the application vendor is right. If not, then they are just trying to put me off and avoid fixing a problem. In this case, I need an authoritative statement as ammunition to take back to their support department. .... Warren