473,769 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connect to SP in remote SQL server

I'm able to connect to my stored procedure in my local database but not able
to connect to my stored procedure in the remote database.

I use several different UserID and Password that all should work. It also
fails when I try a different SP on the remote server. All local SP work. I
copy local SP to remote SQL but still can not connect to remote SP.

Nov 17 '05 #1
5 4378
Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're trying to connect to a remote
SQL server using VS.NET's Server Explorer. But cannot open and edit the
stored procedure on remote server. If there is any misunderstandin g, please
feel free to let me know.

Here, I suggest you try the following:

1. Create a new data connection in Server Explorer using sa account.
2. Connect to the data source and open an SP.

If you cannot open the SP, is there any error messages? Also, can you open
a table?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #2
I'm not using VS.NET's Server Explorer. Below is a copy of my code, I
replaced my sa password with password for this post (for security purposes).
The code works when I change Server=(db) to Server=(local), db is the remote
server. My local license database is a copy of db license database.
The error occurs at oCn.Open(), the error message is "
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or access
denied.
at System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
isInTransaction )
at
System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString options, Boolean& isInTransaction )
at System.Data.Sql Client.SqlConne ction.Open() …………… ………"


string sConnString = "Server=(db);Da tabase=License; Integrated
Security=False; User ID=sa;password= password";
string sProc = "prGet_DealerIn fo";
using (SqlConnection oCn = new
SqlConnection(s ConnString))
{
using (SqlCommand oCmd = new
SqlCommand(sPro c, oCn))
{
oCn.Open();
oCmd.CommandTyp e =
CommandType.Sto redProcedure;
oCmd.Parameters .Add("@sDealerN um", SqlDbType.NChar , 6);

oCmd.Parameters["@sDealerNu m"].Value = txtDealerNum.Te xt;
oCmd.Parameters .Add("@sSaleID" , SqlDbType.Int, 10);

oCmd.Parameters["@sSaleID"].Direction = ParameterDirect ion.Output;
oCmd.Parameters .Add("@sSiteNam e", SqlDbType.NVarC har, 40);

oCmd.Parameters["@sSiteName "].Direction = ParameterDirect ion.Output;
oCmd.Parameters .Add("@sName", SqlDbType.NVarC har, 40);

oCmd.Parameters["@sName"].Direction = ParameterDirect ion.Output;
oCmd.Parameters .Add("@sAmount" , SqlDbType.Decim al, 10);

oCmd.Parameters["@sAmount"].Direction = ParameterDirect ion.Output;

oCmd.ExecuteNon Query();
oCn.Close();

string sSaleID =
oCmd.Parameters["@sSaleID"].Value.ToString ();
string sSiteName =
oCmd.Parameters["@sSiteName "].Value.ToString ();
string sName =
oCmd.Parameters["@sName"].Value.ToString ();
string sAmount =
oCmd.Parameters["@sAmount"].Value.ToString ();

}
}

Also, I checked ODBC connections and added db to User DSN, System DSN and
File DSN but still get same error when I run the code.
"Kevin Yu [MSFT]" wrote:
Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're trying to connect to a remote
SQL server using VS.NET's Server Explorer. But cannot open and edit the
stored procedure on remote server. If there is any misunderstandin g, please
feel free to let me know.

Here, I suggest you try the following:

1. Create a new data connection in Server Explorer using sa account.
2. Connect to the data source and open an SP.

If you cannot open the SP, is there any error messages? Also, can you open
a table?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #3
Hi,

Is db the remote server name? If so, please remove the brackets, and use
the following as connection string.

string sConnString = "Data Source=db;Datab ase=License;Int egrated
Security=False; User ID=sa;password= password";

It seems that the server cannot be found or it is a permission issue. If
the above connection string doesn't work, can you connect to the remote
database using Query Analyzer?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #4
It worked!! Thank you.

To think it was a small change of removing the brackets.

Thanks again.

"Kevin Yu [MSFT]" wrote:
Hi,

Is db the remote server name? If so, please remove the brackets, and use
the following as connection string.

string sConnString = "Data Source=db;Datab ase=License;Int egrated
Security=False; User ID=sa;password= password";

It seems that the server cannot be found or it is a permission issue. If
the above connection string doesn't work, can you connect to the remote
database using Query Analyzer?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #5
You're welcome.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2705
by: Steven | last post by:
Hi All, I've installed MySQL 4.1.12 on my server, I can connect from the local machine with navicat, but not from a remote machine. I checked with 'nedstat' and there is something listening on port 3306. I have tried several users and settings. What i want is to set a user name (:support) and that this user can connect remotely with navicat to the mysql server.
4
6475
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to define the servername / hostname in my Perl Progrem.. Here is the code:
5
5689
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere 4.0, SourceOffSite 4.1, VSS Connect 1.5, SourceXT 2.1, VSS Remoting 2.5,
3
2381
by: bcanavan | last post by:
I'd like to connect to an mdb(v2002+) on the web server which contains readOnly linked tables. My remote users are not permitted to connect directly to the sql server db that the mdb links to because sql server is outside the dmz. The remote users have either Access 2002 or 2003 installed. Any other suggestions for connecting would be appreciated. Thanks,
14
25270
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I tried a test, and I can't bind two sockets to the same port/ip but I can connect with one socket, and bind with another to the same ip/port. Thanks
14
7042
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that sql server resides on is not reachable. The error is different depending on the connection string that I use. If I use the following connection string: "server=192.1.1.1; Initial Catalog=master; uid=The_User; password=The_Password; Connect...
0
4885
by: tamayi | last post by:
I have a problem (like most others posting issues on this forum :) ) I have a remote server running Windows XP SP2, with both SQL Server 2005 Express with Advanced Features and SQL 2000 installed. I can remotely connect to the SQL Server 2000 instance using Query Analyser or Enterprise Manager. I can also remotely connect to the SQLEXPRESS using Management Studio Express Edition. I am writing an ASP.NET 2.0 with VS2005 application...
8
2836
by: BD | last post by:
I am developing C# win form app to work with remote database on SQL Server 2005. Problem scenario is as follows: 1. a form is open that has downloaded dataset to local cache 2. computer is put into stand-by or hibernation 3. later, computer is brought out of stand-by or hibernation 4. when trying to save or close form, SQL exception comes up (remote system closed conn) I know this relates to connection pooling, but I am having a...
7
5943
by: RN1 | last post by:
Is it possible to connect to my local SQL Server 2005 database from a remote web server? If yes, what ConnectionString do I use? Thanks, Ron
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.