My site works fine in VWD2008 express, but I get this error when I try to use it on my live website. 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. According to this article: http://support.microsoft.com/kb/914277 I am supposed to:
1. Click Start, point to Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Surface Area Configuration. Ok, there is no such program in this folder. The only thing in there is "SQL Server Error and Usage Reporting"... The other thing I am greatly concerned with is this: All is want is for my webpages to be able to access my database for user authentication. I DO NOT want to grant the internet rights to remote connect to my database.
I get the following error and have been trying to figure out why I keep getting it. Initially, I had placed my project under wwwroot folder and ran it under IIS and it gave this error. Then I moved it to my local C drive and same thing. I am sharing this project with two other co-workers and all our config files and code files are same...they don't get this error but I do. I checked that SQL Server Client Network Utility has TCP/IP and the 'Named Pipes' enabled. I thought maybe I have setting in the Visual Studio 2005 that I'm not aware of that's causing this problem...it can't be the server since my co-workers aren't having this error and can't be anything in the code since all of us are sharing this project through vss. I dont' think using different version of .net framework can create this error. I changed the version from 2.0 to use 1.1x and it gave same error... Any help would be greatly appreciated. Thanks in advance.
Server Error in '/RBOdev' 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: 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. 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)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) +739123 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +685966 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +109 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +383 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181 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.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.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84 System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197 System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.GetConnectionHolder() +16 System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.LoadPersonalizationBlobs(WebPartManager webPartManager, String path, String userName, Byte[]& sharedDataBlob, Byte[]& userDataBlob) +195 System.Web.UI.WebControls.WebParts.PersonalizationProvider.LoadPersonalizationState(WebPartManager webPartManager, Boolean ignoreCurrentUser) +95 System.Web.UI.WebControls.WebParts.WebPartPersonalization.Load() +105 System.Web.UI.WebControls.WebParts.WebPartManager.OnInit(EventArgs e) +497 System.Web.UI.Control.InitRecursive(Control namingContainer) +321 System.Web.UI.Control.InitRecursive(Control namingContainer) +198 System.Web.UI.Control.InitRecursive(Control namingContainer) +198 System.Web.UI.Control.InitRecursive(Control namingContainer) +198 System.Web.UI.Control.InitRecursive(Control namingContainer) +198 System.Web.UI.Control.InitRecursive(Control namingContainer) +198 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
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,
Hi,I have SQL Server Express Edition. I tried working out some ASP.NET Labs in my local system. Here is the link of the Virtual Lab which I tried. http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032286906&EventCategory=3&culture=en-US&CountryCode=USI recieve this error in my local system. 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 tried working out solutions from various websites. But the no solution is effective. Could anyone help me in solving this issue.
I am trying to connect to a sql server 2005 server using either windows auth or sql server auth but I can not. When I click on the connect button to connect to a server it never connects. I can not cancel once I press connect. It never times out after I press connect. I removed all registered servers that were registered previously. I have uninstalled all software that involved sql server (and sql2000) run a registry cleaner(not microsofts), installed the software to a new directory and still I can not connect to the sql2005 server (the only db).
Any ideas?
I am running Windows XP with latest services packs for both windows and sql server. I have visual studio 2005 installed on my machine and I have had sql express installed on it previously.
I am trying to connect to a remote sql server 2005. So I have install the Microsoft SQL Server Management Studio Express. When I try to connect I get the error below.
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) (Microsoft SQL Server, Error: 53). Can some one please help. I have even port no 1533 on my pc. Thanks.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this I use Microsoft Windows Vista Home Professional I have already installed to my computer Microsoft SQL Server 2005 and SQL Serves Express. I used to be successful to connect to the SQL Server but now I CAN NOT.
Not: I try to run SQL Server 2005 but I can not, even I logged on to my computer with an administrator rights. On the other hand I can start and stop the SQL Server Express easily.
As a result, how can I solve this problem. Thanks in advance. Bilgin Kılıç Additional Details
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'm about to go absolutely nuts. I've tried so many things including:
1) Of course making sure Remote connections and both TCP/IP and named pipes are enabled for SQL 2005 2) Verified my connection string works. I even tested it in Enterprise Library using the tool and it connects successfully via windows authentication 3) Made sure of course my logged in user is a member of the administrator group and that my user in SQL 2005 logins has db_owner and full rights to the DB I am connecting to. I also made sure the NT AUTHORITY as well as the 3 sql service users have db_owner rights as well as the adminstrator in the SQL Server logins all have db_owner to the DB 4) Started the SQL Server Browser service, SQL Server DB engine, and SQL Server Agent 5) Made sure my site is setup right in IIS 7. I checked the connection string in there as well as it shows up in IIS7 in one of the sections. Using Windows authentication and it is enabled for my site 6) Tried running the .net site using both localhost (IIS) and also tried using the Visual Studio built-in web server. Both give this message still
Error Details:
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:
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) +800131 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +381 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +357 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494 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
Hi, I've been trying to fix this error for two days! and I really need the advice of the experts please! Computer XP Professional Service Pack2, SQL Server 2005 and Visual Studio 2005 (both Standard Edition) ConnectionString: <connectionStrings> <add name="MyConnectionDB" connectionString="Data Source=(MyServerSqlServer2005);Initial Catalog=MyDB;User ID=sa;Password=PasswordforSA" providerName="System.Data.SqlClient" /> </connectionStrings>
C# code string myConnectionString = ConfigurationManager.ConnectionStrings["MyConnectionDB"].ConnectionString; SqlConnection myConnection = new SqlConnection(myConnectionString); myConnection.Open(); Here I get the error: {"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)"}
What I checked so far:
ServerName and Instance Name OK! Database, Username and password OK! SQL Server 2005 Surface Are Configuration - Remote connections using both TCP/IP and Pipe Names OK! SQL Configuration Manager - Protocolos Enabled (TCP/IP, Pipes, shared) OK! SQL Server Browse running and active OK! Am I missing something? I never had this problem with SQL Server 2000 and Visual Studio 2003. Thanks in advance for any help or suggestion you can give me. Sasa
Hi All, After I installed sql server 2005 64bit standard edition on Windows Server Enterprise 2008 64bit, I cannot connect to the sql instance using the sql management studio on the same machine! I verified that:
service is running,
in surface area configuration: remote connections to local and remote are enabled, for TCP/IP and named pipes.
ran the command netstat -avn| findstr 49279 to make sure that the server is listening.
firewall is off, but this does not matter since I'm connecting locally to local instance
I'm using domain controller account to login to sql server / also tried the sa account. what else can be wrong?
I need to connect to a SQL server thats running in say abc.trident.com and also sits in a shared environment..
I have couple of questions
1) That SQL server is accessible from my network, yet when I swtich on my enterprise manager I am unable to view that in the list of running SQL servers in the populated list.
Is it because its sitting in a shared environment I am unable to view that?
2) What is the connection striing I should use to connect to the server..When I try to configure a SQL server registrations it normally asks for SQL Server name along with the user authentication
Should I mention fill the Server: field as
abc.trident.com
or
// abc.trident.com/abc.trident.com
to connect to the clustered server.
Can some one tell me the proper connection string if both aforementioned ones are incorrect?
I have a msaccess linked server that I use to execute sql 2000 stored procedures from a front end in adp (access data project) format without any problem, if it is used on the same machine where the sql server resides (with any user logged on). In any other machine on the local network where I also need to use it, I get an ole/db error message saying that the microsoft jet database engine can not open the file because it's allready opened exclusivly or because it do not has permissions. I created the linked server with both UNC and normal path with the same result.
SqlConnection myConnection = new SqlConnection(myConnectionString);
myConnection.Open();
Here I get the error: {"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)"}
What I checked so far:
ServerName and Instance Name OK! Database, Username and password OK! SQL Server 2005 Surface Are Configuration - Remote connections using both TCP/IP and Pipe Names OK! SQL Configuration Manager - Protocolos Enabled (TCP/IP, Pipes, shared) OK! SQL Server Browse running and active OK! No Firewall
Am I missing something? I never had this problem with SQL Server 2000 and Visual Studio 2003.
Thanks in advance for any help or suggestion you can give me.
When my default.aspx page loads I get this error for the connection to my SQL 2005 DB. 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 have already gone to Surface Area Configuration to ensure that Remoting with both Named Pipes or TCP/IP is enabled and it's set to both for remoting.I verified that my local account has access to the DB.Not sure what else to check.
Hi all.I use Visual Studio .NET 2002 and SQL Server 2005 Express Edition as database.I try to connect to database using server explorer.Test connection is OK. When I done with it and click OK, the message prompt that "Unable to connect to database".So, is it impossible to connect SQL Server 2005 Express Edition using the server explorer?But, the connection is ok when I connect through code cause I can retrieve and update database.
I had asked a question last week and I realized that I had phrased it in a misleading way. Within a lab environment at my company, we are experimenting w/ accessing remote SQL data files stored separately on another machine from the SQL server itself (whether it be another client or server).
The experiment is this: You have one client machine accessing a SQL server via Enterprise Manager. The datafiles that you are trying to access are stored on another machine that does not have SQL Server installed. This remote machine only has the datafiles.
Can one map a static path via UNC from the SQL server to the datafiles on the remote machine and then access these datafiles (as long as the user's account has the appropriate permissions to the remote machine)? To my understanding, within SQL server you can only access datafiles that are stored locally on the SQL server itself.
The other thing that I was wondering was if the type of user account had some significance in this situation. More than likely, a local user account would not be able to access the remote machine w/ the datafiles even if the SQL server could map an UNC path and retain it. A domainuser account might be able to do this though.
Any help that you could provide would be appreciated.
I am running into a problem and have been browsing the web and reading nonstop for answers with no success. My company just installed SQL Server 2005 and I am trying to connect to it via SQL Server Management Studio from my network computer in the same office building.
When I browse for Local or Network Servers in the initial popup box at SQL Management Studio Startup, it doesn't show any servers at all. Is there something I need to enable on the Server using the Configuration Manager or one of the other tools to allow my network computer to "see" the SQL Server?
Any insight would be MUCH appreciated. Even a link to a how-to would suffice. Thank you.
i tried to connect to a SQL Server Compact Database (version 3.5) with SQL Server Management Studio Express (Version 9.00.3042.00).
But i get the follwing error message (sorry, it's a german message):
..................................... Es kann keine Verbindung mit 'D:DocumentsVisual Studio 2008Projects\_ProduktivSuperkalibrator_PrototypenSuperkalibrator_PrototypenDatenbankDatabaseTest.sdf' hergestellt werden.
Sie versuchen, auf eine ältere Version einer Datenbank von SQL Server Compact Edition zuzugreifen. Falls es sich um eine Datenbank von SQL Server CE 1.0 oder SQL Server CE 2.0 handelt, führen Sie 'upgrade.exe' aus. Falls es sich um eine Datenbank von SQL Server Compact Edition 3.0 oder höher handelt, führen Sie die Komprimierung und Reparatur aus. [ Db version = 3505053,Requested version = 3004180,File name = D:DocumentsVisual Studio 2008Projects\_ProduktivSuperkalibrator_PrototypenSuperkalibrator_PrototypenDatenbankDatabaseTest.sdf ] (SQL Server Compact Edition ADO.NET Data Provider) .....................................
Is there a solution to manage Compact Databases in Version 3.5?
I have installed Server 2005 Express on a pc running Windows Server 2000 sp4 which I want to use as the server for a network of pcs. However, I am unable to login to SQL Express on this machine from Sql Server Management Studio Express. I am in mixed mode and trying to connect with Server Authentication. I get various error messages none of which seem to point to the problem.
Networked to this pc are several other machines running Xp Professional/Home sp2 and if I install SQL Express on one of these I can log in to SQL Express on that machine without any problem. I can also connect to it via the network from the Win Server 2k machine.
Does anyone know of any issues when installing Server 2005 Express on a pc running Windows Server 2000 sp4.
I've run into a problem after upgrading production servers running under Microsoft Cluster Server, Windows Enterprise Server 2003 SP1, and SQL Server 2005 SP1 Enterprise Edition.
Once I completed the upgrade and applied the patch, I needed to examine the values set in the Features component of the Surface Area Configuration tool. The tool attempts to connect to localhostinstancename, but reports the following error:
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)(Microsoft SQL Server)
I'm logged into the virtual server via Remote Desktop, but the SAC tool thinks I'm logged into the physical server supporting the virtual server. I seem to be caught between a rock and a hard place here, as I can't enable remote connections without first gaining access on the server itself.
Hi, i am trying to get to my hosting companies database server. Its SQL Sever 2000, but i want to connect through SQL Server Management Studio 2005. The connection is unable to be established, although i have tried all sorts of settings for the connection. I called the hosting company and they told me to connect using the IP address of the name server for my domain. It failed and i called again to check back, and one of the guy told me that u cannot connect to an instance of sql servr 2000 from sql server 2005. Is this true? Please help.
I want to populate data in SQL server database (SQL server 2008 R2) from SSAS cube located on different server (SQL server 2012). My SQL database present on Server A and cube on Server B.
To implement I am trying to create linked server. But its giving errors related to provider and product.
Here is the information that I have... ( ps all information is not the actuall information )
1) URL abc.somehostingcompany.com IP: 211.11.111.1 PORT: 1433 ( NOTE: if I go to a cmd promt and type in ping abc.somehostingcompany.com I get a response )
2) dbname = mydatabase
3) userUid = sa pwd = sa
Inside SQL Server Configuration Manager --> SQL Server Network Configuration --> Protocols for SQLEXPRESS, I enabled TCP/IP and Shared Memory. Inside the properties of TCP / IP, I made sure under the "IP Address" tab that the
IP1: Active = yes
IP1: Enabled = yes
IP1: IP Address = abc.somehostingcompany.com
IP1: TCP Dynamic Ports = 0
IP1: TCP Port = < empty string >
I clicked "OK", and I stopped and started the SQL Server 2005 Services --> SQL Server (SQLEXPRESS). Then I started up SQL Server Brower.
Lastly I go to SQL Server Management Studio Express and try to connect to this remote server and database and I keep getting timeout issues and a message saying that the default settings for SQL Server Express do not allow remote connectioning by default.
Any ideas what I could be doing wrong? Should I use the port number instead of Dynamic Ports? Should I use the real IP address? Does the LOG ON AS under SQL Server (SQLEXPRESS) properties need to be updated?
Hi all. Im using Visual Web developer 2005 and have successfully connected my SQL Server to Visual Web developer website. When i run it locally, its fine. But, i now would like the site to be placed on the net - but im not sure how to connect it properly in the webhost. Can someone tell me how this is done please, or a link? cheers.
Hi, I have a problem in logging in to an SQL Server database engine. I can log in to the engine with Windows authentication method. The problem is, when I create a page with an SqlDataConnection control, the page can not connect to the database engine eventhough I select "Use Windows Authentication" when configuring the SqlDataConnection. What should I do?Best regards,Haris
Hi i'm having lots of problems connecting my application to a database. I'm using Visual Web developer 2008 (coding in VB) and trying to connect to a locally installed version SQL server Express. what i'm trying to do is using a DropDownList box get a user to select a name. This will then automaticly run a SQL query to pull data out of the DB and into a GridView. i'm coding (in VB only) everything under the DropDownList.SelectedIndexChanged section. the query i want to run is - SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @owner_id) The owner_id field references another table (owner). Therefore i run the inner query to get the owner_id based on the selected name in the dropDownlist, then let the outer query pull out all tasks which match the result from the inner query. my code at the moment is Dim ds As New DataSet Dim myconnection As SqlConnection 'create a connection 'create connection to DB myconnection.ConnectionString = "server=localhost;database=taskDB" 'create the sql commandDim objcmd As New SqlCommand("SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @owner_id)))", myconnection) objcmd.Connection.Open() 'open the connection to DB Dim objreader As SqlDataReader = objcmd.ExecuteReader Dim da As New SqlDataAdapter da.SelectCommand = objcmd 'fails here sql not allowing remote connection da.Fill(ds)Me.GridView1.DataSource = da Me.GridView1.DataBind() 'close the connection to the DB objcmd.Connection.Close()
The application fails when you select a name from the drop down box. fails at - myconnection.ConnectionString = "server=localhost;database=taskDB" Error is "Object reference not set to an instance of an object." If i comment out this line, i get the same error but at it stopps at the objcmd.connection.open(). Strange.
Can anyone tell me what i am doing wrong? Have i setup the connection to the DB ok?
Hi, I am having some number of systems with SQL server installed on all of them.I want to start or stop SQL server on a remote machine using the IP address of that system. Can this be done,is the SQL SERVICE MANAGER is meant to do anything in this case....? sorry for reposting this question. plzz reply. thanks.
Hi I built a new aplication using asp.net 2, and i created a data base in it which it name is (Database.mdf). i created a datalist and put it's data source database.mdf and a table e.g (store1) when i run it in local server (my computer) it works perfect but when i upload it on main server that i rented it, it cant connect to server and show the error message that the server can not connect to my created server. what is the problem? is the problem is related to app_data or.....
I have been trawling the net to find a decent example of a way to connect to an sql 2000 server using asp.net and run a few commands.
One of the commands i need to run is: "EXEC sp_addlogin 'Albert', 'B1r12-36', 'forum2'"
Please, please, please could someone show me how to do this, and display a 'successful' message on the page if the command completed successfully...i will be eternally greatful.
I am a newbie to this...I am trying to right a connection string to a SQL Server DB. I do not have the full blown SQL Server, but just the SQL desktop engine. I put together the following in Web Matrix and it works without a problem. However, when I copy this over into Visual Studio.net I get an error at the "myConnection.Open()" command. Any ideas why it would work in Web Matrix but not in Visual Studio. When I test the connection to the SQL DB in Studio it says that the test completed succesfully so I don't think I am having a problem actually connecting, so I am not sure what the problem is.
Code........................................ Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myConnectionString As String myConnectionString= "server=Discovery3;database=dbDVD;trusted_Connection=true"
Dim myConnection As New Data.SqlClient.SqlConnection(myConnectionString) Dim myInsertQuery As String = "INSERT INTO tblMaster(TITLE) values('" & TextBox1.Text & "')" Dim myCommand As New Data.SqlClient.SqlCommand(myInsertQuery) myCommand.Connection = myConnection myConnection.Open() myCommand.ExecuteNonQuery() myCommand.Connection.Close()