DataSource Controls :: Connecting To SQL Server On VPN?
Mar 9, 2010
I need the syntax for a connection string in web.cong to connect to a SQL Server 2005 database that is on a VPN. I have an account on the DB that I can use....just don't know how to construct the connection string properly.
While working with LINQ to ENTITIES I see that there is only a way to use stored procedure that is returning one entity only, or a view that is a join of two entities.
But what if I need in ASPX page to get two tables that there is NO connection between them, no join can be done between them at all.
I have one Stored Procedure that return the two tables, but entities don't support this right now.
I can split them to two Stored Procedure and call each of them separately.
i have a project running good (database and application both are in same server). some days before we've decided to place databse (sql server 2000) in different server.we created new server with windows server 2003 and Sql server 2000; nothing else is installed in it.And then i register new server's sql in old server's sql server. it connected successfully. even i can fire a query to new server from old server.
Both new and old server having windows server 2003 and Sql server 2000.
Now the problem :I CAN NOT ACCESS NEW SERVER'S DATABASE FROM MY APPLICATION.
When ever I try to connect to server through Microsoft sql server management studio express then an error is generated saying that
Cannot connect to .//SQLEXPRESS
Additional Information
A network related or instance specfic error occured while connecting to SQL server. The server not found or not accessible verify that instance name is correct and that SQL server is configured to allow remote connections.(Provider: Named Pipes Provider, error 40-could not open connection to SQL server )(Microsoft SQL server, Error:53)
connecting my database to the online server. My server is seekdotnet. But I had been receiving this error code Cannot open database "database.bak" requested by the login. The login failed. Login failed for user '219_nypmecom'.
I am trying to host my website developed on ASP.NET framework 3.5. this website project is working perfectly on my system in local host enviorment. but when I try to upload it to hosting server ( mochahost.com-- hosting server) it is creating problem.
I have uploaded all the webpages to standard folder, created the database using script file, I can see the table and data through Plesk control panel, so database creation is not the problem. I have change the connection string in web.config file according to the template given on the site.
here's the connection string I am using:
<connectionStrings> <add name="JJMCONDO" providerName="System.Data.SqlClient" connectionString="data source=db200.my-hosting-panel.com;Initial Catalog=ahalyam1_varun;User ID=xxxxx;Password=xxxx" /> </connectionStrings> where JJMCONDO is the connection name database name: ahalyam1_varun
I have a SQL server in my office. I can connect from my home development workstation website to the remote SQL server with no problems but when I upload the site to the web host and try and use the same SQL server it fails with 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible'
I would like to do a connection of asp.net page with Sql Server. Here I would like to read the Windows user account name and pass in the connection.The connection should be Windows authentication. IIS server and Sql server are installed in different machine. Here I am able to connect locally, When I am running from server, It takes windows account of Server.
so i can read local account(Where user is accessing the web application) and make windows authentication sql server connection.
Background: I use SQL server 2005 developer edition and visual studio 2008. Visual studio 2008 is running on a local machine with Vista business edition. SQL server is running on a remote server using Windows server 2003. Both computers are within the same domain.
Problem: First, I used the server explorer to connect to the SQL server. Everything works as desired. Then I write code to do the same thing. I keep getting the following error message:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
However, I used the exactly identical connection string as the one used in the server explorer. So connection string should not be the problem. In addition, I tried the test code in MSDN, which tells whether my domainusername can flow the network. It turns out the user name is fine. I also went to the SQL server management studio and found the login for my computer is NVCWeihao while my computer login name is NVCweihao. I am wondering if this uppercase letter really affects the connection.
Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider. I have set up a db locally which mimics the production DB, THe production db and website has no has no issues.
THis used to work till i had hard disk failure and had to reinstall all software and do the db from scratch. Used the table scripts and ran the aspnet_regsql. I am using sql server express 2008 asp.net 3.5 I am using custom provider for Roles and custom membership provider for Memberships. Pretty sure the problem is in the db permissions, though I have set up Users in the Security of the DB.
I am using Visual Studio 2008 and asp.net technology with C# language. Whenever I try to choose any datasource for databound control like "gridView" of "ObjectDataSource". The connection can be tested as OK but when I click on OK the it gives following error and database could not be added: "Object Reference not set set to an instance of an object." it was working perfectly fine in Visual Studio 2005, so kindly help if there is some settings that are to be adjusted for 2008 version.
I was working on a asp.net project earlier but due to some OS problem I had to re-install the OS..so before re-installing the OS I detached my sql database and then attached it back after installation..but I am having a login problem now..the previous servername was XYZ-DB840C74SQLEXPRESS..so this user i.e. XYZ-DB840C74ASPNET is added to the database's permissions..now my new server name is XYZ-8D50FD73SQLEXPRESS..but I am unable to add this user through the permissions wizard..I am getting the following error: Cannot open database "finance" requested by the login. The login failed. Login failed for user 'XYZ-8D50FD73ASPNET'.
In my windows application, i am listing the System DSN's configured on the remote machine in a combobox. Once i select the DSN and click on Connect button, i should be able to connect to the remote database. I am trying to open the connection to the database using ODBC but am getting the below error.
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
I have a problem with connecting a DropDownList to a DataSource.
The scenario: When I add am item to the database (I do this using a GridView/ObjectDataSource / SPROC) I want to update a DropDownList that lists this items as well.This DropDownList is linked with another ObjectDataSource. Now, I listen to the RowCommand event of the GridView and in a certain case I refresh the DataSource of the DrpoDownList and do a DataBind to the DropDownList afterwards.
The strange thing is, that when I take a look at the DropDownList's Items-Collection during the Page's OnPreRender event handling, the items collection contains the new entry but the new entry is not rendered, i.e. when I take a look at the rendered HTML the <option></option> entry for the new value is missing.
After another postback to the page the entry appears in the DropDownList?
I have no trouble connecting to a SQL server with code in my web config file for user registeration. But I am having trouble telling it to go to a particular table.
I have two PCs with Windows Server 2003 standard adition installed on them, each are in a saperte room, and having SQL Server 2005 Express. Now I want to let Myserver to connect to server1 with a readonly access to a database on it. I figured to create a user acount on server1, and make it as a login account in SQL Server and grant the appropreate privilage. Now I'm wandering are there any security risks regarding this approch.
We have a MOSS 2007 custom web part based on a user control that queries a database cluster. When the connection to the database is made, we regularly experience the error below and have had to create a work-around in the code to retry the connection. We have 3 environments - development, staging and production; the error only occurs in production. The difference in the production environment is it is a farm with 3 WFEs and a SQL cluster, where development and staging are single machine instances. All are MOSS 2007 & SQL Server 2008. We cannot find what is causing this issue and I'm hoping someone else has experienced a similar problem and knows the cause.
This is the error that occurs frequently when the query is executed: System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.WriteSni() at System.Data.SqlClient.TdsParserStateObject.ExecuteFlush() at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at [Our Namespace.OurMethod](String someParam)
More than one method will generate this, but this is typical code, note the retry work-around: public static DataTable OurMethod(string someParam) { const string query = "sp_OurStoredProcedure"; var resultsTable = new DataTable(); var connection = new SqlConnection { ConnectionString = OurDatabaseConnection }; var command = new SqlCommand(query, connection) { CommandType = CommandType.StoredProcedure }; var dataAdapter = new SqlDataAdapter(command); var retry = 5; SqlConnection.ClearPool(connection); while (retry > 0) { try { command.Parameters.Clear(); command.Parameters.AddWithValue("@someParam", someParam); connection.Open(); dataAdapter.Fill(resultsTable); retry = -1; } catch (Exception ex) { retry--; if (retry <= 0) { LogError("Exception: DataAccess:OurMethod: *RETRIES EXCEEDED* " + ex, "error"); } else { SqlConnection.ClearPool(connection); LogError("Exception: DataAccess:OurMethod: ATTEMPTS REMAINING " + retry + ". " + ex, "warning"); } } finally { dataAdapter.Dispose(); command.Dispose(); connection.Dispose(); } } return resultsTable; }
I have developed a web application in asp.net with C# in visual Studio 2005. And i used sql server 2008 as back end. When i run the program, it shows 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
or one of my project, I use Access 2007.I have application written by Access, that use database : Sql-Server 2007.I am using XP for the any company computer.The dsn file is on network, and include connectionString with username + password,ut I want to access the database from any user with automatic authentication (no need for user and password).
how do i connect visual web developer to sql server express 2008? in the Database Explorer, i right click on Data Connections, click Add Connection..., and in the Data source box i choose Microsoft SQL Server (sqlClient), which i'm guessing doesn't connect me to a database file, but to sql server express itself(?). in the server name box when i click the drop down box, there's nothing there and that's where i get stuck.
I am using this code to connect to my exchange server using POP3.I am trying to retrieve an inbox of basically emails that have not been read however, i am just getting a bunch of gibberish and its reading an email. modify my code to just read the most recent messages.
Try tcpClient.Connect(hostName, 110) Dim networkStream As NetworkStream = tcpClient.GetStream()[code]...
when i use top instead of retr i get this
+OK X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: by xch0p.com id <01CB58CE.A6A4EA@p.com>; Mon, 20 Sep 2010 09:17:07 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CB58CE.81A6A4EA" Content-class: urn:content-classes:message Subject: What we need to do?? Date: Mon, 20 Sep 2010 09:17:07 -0500 Message-ID:
I have written a method for getting information about the ip-addresses of visitors to my web site. The method is called from Page_Load. It connects to the Ripe whois database and gets information about the ip sent. Everything works perfectly when I try it locally using localhost, but as soon as I upload the code to my web host it stops working, and I get the following error message saying that it can't connect to Ripe. The code is exacly the same as I use locally. (The relevant code is included in the error message below). I tried to contact my web host to ask them, but they said it was beyond their expertise...
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 193.0.6.135:43
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.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 193.0.6.135:43
Source Error: [Code]....
Line 38: {Line 39: TcpClient objTCPC = new TcpClient();Line 40: objTCPC.Connect("whois.ripe.net", 43);Line 41: Line 42: string strDomain = ip + "