473,769 Members | 5,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connection string to access remote SQL server?

Hi,

I have tried the following connection string to access a remote SQL Server:

oConn.Open "Provider=M S Remote;" & _
"Remote Server=http://remoteservernam e;" & _
"Remote Provider=SQLOLE DB;" & _
"Data Source=remotese rvername;" & _
"Initial Catalog=databas ename;" & _
"User ID=mylogin" & _
"Password=mypas sword"

I keep getting the error when it tries to execute that code:

Object Variable or With Block Variable not set

Does anyone know what could be wrong? Thanks.
Nov 13 '05 #1
3 8657
On 1 Oct 2004 05:27:42 -0700, 4i******@gmail. com (cougar) wrote:

Well, since you're not in a With block, you must ask yourself which
Object variable is not set. You're only using a single object variable
in this code: oConn.

-Tom.

Hi,

I have tried the following connection string to access a remote SQL Server:

oConn.Open "Provider=M S Remote;" & _
"Remote Server=http://remoteservernam e;" & _
"Remote Provider=SQLOLE DB;" & _
"Data Source=remotese rvername;" & _
"Initial Catalog=databas ename;" & _
"User ID=mylogin" & _
"Password=mypas sword"

I keep getting the error when it tries to execute that code:

Object Variable or With Block Variable not set

Does anyone know what could be wrong? Thanks.


Nov 13 '05 #2
It could be the missing semicolon nafter 'mylogin'
It could be an if/endif block not even involving this block of code;
It could be you have mal-defined oConn;
or any of several other items.

To get a better answer, I would post as close to the code as you can, not
just

"Initial Catalog=databas ename;" & _

which obviously is just an example and not your real code.
Darryl Kerkeslager

"cougar" <4i******@gmail .com> wrote in message
news:cf******** *************** ***@posting.goo gle.com...
Hi,

I have tried the following connection string to access a remote SQL Server:
oConn.Open "Provider=M S Remote;" & _
"Remote Server=http://remoteservernam e;" & _
"Remote Provider=SQLOLE DB;" & _
"Data Source=remotese rvername;" & _
"Initial Catalog=databas ename;" & _
"User ID=mylogin" & _
"Password=mypas sword"

I keep getting the error when it tries to execute that code:

Object Variable or With Block Variable not set

Does anyone know what could be wrong? Thanks.

Nov 13 '05 #3
yeah, you need to post more information about your code. Sounds like
you didn't define a variable (oConn maybe?). Put some breakpoints in
your code and step through it with the debugger - you should get a
better idea of where your code is wrong.

"Darryl Kerkeslager" <Ke*********@co mcast.net> wrote in message news:<2t******* *************@c omcast.com>...
It could be the missing semicolon nafter 'mylogin'
It could be an if/endif block not even involving this block of code;
It could be you have mal-defined oConn;
or any of several other items.

To get a better answer, I would post as close to the code as you can, not
just

"Initial Catalog=databas ename;" & _

which obviously is just an example and not your real code.
Darryl Kerkeslager

"cougar" <4i******@gmail .com> wrote in message
news:cf******** *************** ***@posting.goo gle.com...
Hi,

I have tried the following connection string to access a remote SQL

Server:

oConn.Open "Provider=M S Remote;" & _
"Remote Server=http://remoteservernam e;" & _
"Remote Provider=SQLOLE DB;" & _
"Data Source=remotese rvername;" & _
"Initial Catalog=databas ename;" & _
"User ID=mylogin" & _
"Password=mypas sword"

I keep getting the error when it tries to execute that code:

Object Variable or With Block Variable not set

Does anyone know what could be wrong? Thanks.

Nov 13 '05 #4

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

Similar topics

9
6566
by: Niyazi | last post by:
Hi, I can connect using my PC local SQL Server Enterprise manager to Remote SQL Server. But I cannot connect using my Connection string? strConn = "Data Source=190.168.0.97,1433;Network Library=DBMSSOCN;Initial Catalog=DBANK;User ID=myID;Password=myPASSWORD;" Does anyone knows any idea?
10
2723
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through VS, however, when I change to release and put it out on the web it fails giving me the following error message The underlying connection was closed. Could not establish a trust relationship with the remote server.
2
4628
by: Maziar Aflatoun | last post by:
Hi guys, I'm using Windows authentication to connect to SQL Server 2000. On my computer the connection is fine. Now if I move it to a remote server, how to I hard code my Username/Password in my connection string (using Windows NT authentication and not SQL Server authentication)? Thank you Maz.
16
2315
by: peshekeedweller | last post by:
Using asp.net 1.1. vb.net 2003. I am trying to connect to a remote sql server 2000 on a virtual machine running windows 2000 server. I can connect through the server explorer in visual studio, but cannot connect through code. I have done it before and can not do it now; I don't know what changed. (I also cannot connect to local Access database through code though I can from server explorer.) The code is: conn = New SqlConnection("data...
1
2295
by: vighnesh | last post by:
Hi All I am dealing a project in ASP.NET in which I have to establish a connection to SQL Server 2000 database,where the database was located on a remote system. For this I have used SQLConnection object and specified the connetion string.But when it comes to establish a connection its giving me the Error that I. Connection string : workstation id=localhost;packet size=4096;user
1
1900
by: Chris Love | last post by:
I have already asked this, but no one seems to know the answer. Here is the timeline. I wanted to use the membership/roles functionality in a site. I got all sorts of errors trying to get this setup on the site through the admin interface. So I yanked it out of the application since it did not work. Now everytime I load the site after changing the application I get this error message. If I simply refresh the page, everything works...
10
5797
by: cleo | last post by:
I am migrating from VB6/Access to Visual Basic and SQL Express. I have success writing test code on my local machine and am now setting up tests for deployment to a server. I have installed SQL Express on a Windows 2003 Server. I can connect and create databases on the Remote Server from my local machine using SQL Management Express, so I know Remote Access is working. However, I am unable to connect using a connection string within...
1
6900
by: Chris | last post by:
hi I have big problem. I am writing a small win application. It will work on remote MS SQL database (2005). Firstly, I need to log on to the server. The server supports remote connections and sql and windows authentication. I declared connection string as follows: conn = new SqlConnection("user id=<user>;password=<pass>;server=<IP>,1433;database=<dbname>;Trusted_connection=yes;connection timeout=3"); Using that string I can log on...
4
1574
by: glbdev | last post by:
Hi. I am having an problem connecting to a remote SQL Server. Other applications (using access) are connection to it but I cannot get it to work through ASP.Net. Here is my connection string: Public Function StringConnection() As String Return "Server=myservername;Database=mydatabasename;User ID=myid;Password=mypassword;" End Function
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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
8872
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...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3562
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.