473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Refresh/Reconnect to SQL Server

I'm using Access 2K's built-in connection method (FILE>CONNECTION) with
the Windows NT Integrated Security login option to establish my server
connection. Is there a way in code to refresh or reconnect to this
connection?

Nov 13 '05 #1
10 2830
Br
lauren quantrell <la*************@hotmail.com> wrote:
I'm using Access 2K's built-in connection method (FILE>CONNECTION)
with the Windows NT Integrated Security login option to establish my
server connection. Is there a way in code to refresh or reconnect to
this connection?


Have you looked at the Northwind project sample?

I use some code on startup to check that there is a valid connection. If
there is no connection it opens the connection form. You can call up the
connention form using "DoCmd.RunCommand acCmdConnection".
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #2
Thanks, but I'm not interested in presenting the user with the
connection form. That would cause all manner of havoc!
What I am trying to do is, in VBA code, re-establish this connection.
lq

Nov 13 '05 #3
On 2 Aug 2005 20:01:08 -0700, "lauren quantrell"
<la*************@hotmail.com> wrote:

There should be no need to do this, unless you want to *re*connect,
presumably to a different data source.
If your SQL Server is static, you connect once and forget about it.

-Tom.
Thanks, but I'm not interested in presenting the user with the
connection form. That would cause all manner of havoc!
What I am trying to do is, in VBA code, re-establish this connection.
lq


Nov 13 '05 #4
I have users experiencing "Connection Failure" messages over a WAN.
What I want to do is to test the connection before executing some
UPDATE/INSERT stored procedures and if the connection doesn't exist,
attempt to reconnect before executing them.
lq

Nov 13 '05 #5
This code is in a standard module. I call it from my opening form:
Public Sub LetConnectionString()
With CurrentProject
If Not .IsConnected Then
.OpenConnection ("PROVIDER=SQLOLEDB.1;" _
& "INTEGRATED SECURITY=SSPI;" _
& "INITIAL CATALOG=FFDBAESO;" _
& "DATA SOURCE=ITSERVER9")
End If
End With
End Sub
It's intended to change the connection for the development copy to the
connection for the production copy, but it should work in the situation
you describe.

Nov 13 '05 #6
This code is in a standard module. I call it from my opening form:
Public Sub LetConnectionString()
With CurrentProject
If Not .IsConnected Then
.OpenConnection ("PROVIDER=SQLOLEDB.1;" _
& "INTEGRATED SECURITY=SSPI;" _
& "INITIAL CATALOG=FFDBAESO;" _
& "DATA SOURCE=ITSERVER9")
End If
End With
End Sub
It's intended to change the connection for the development copy to the
connection for the production copy, but it should work in the situation
you describe.

Nov 13 '05 #7
Thanks!

Nov 13 '05 #8
Thanks!

Nov 13 '05 #9
Br
lauren quantrell <la*************@hotmail.com> wrote:
I have users experiencing "Connection Failure" messages over a WAN.
What I want to do is to test the connection before executing some
UPDATE/INSERT stored procedures and if the connection doesn't exist,
attempt to reconnect before executing them.
lq

To test if there is a connection use: CurrentProject.IsConnected

To get the current connect string use:
CurrentProject.BaseConnectionString

To reconnect use: CurrentProject.OpenConnection strConnectString

In my routines I do other things like trying to start the SQL server if
it's stopped, testing to see the database exists on the server......
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #10
Br
lauren quantrell <la*************@hotmail.com> wrote:
I have users experiencing "Connection Failure" messages over a WAN.
What I want to do is to test the connection before executing some
UPDATE/INSERT stored procedures and if the connection doesn't exist,
attempt to reconnect before executing them.
lq

To test if there is a connection use: CurrentProject.IsConnected

To get the current connect string use:
CurrentProject.BaseConnectionString

To reconnect use: CurrentProject.OpenConnection strConnectString

In my routines I do other things like trying to start the SQL server if
it's stopped, testing to see the database exists on the server......
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #11

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

Similar topics

0
by: Steve | last post by:
I need to introduce a JMS reconnect feature into an existing application. Basically, the application is a simple consumer of messages from a JMS topic. My requirement is to have the application...
2
by: Abram | last post by:
I have an ODBC 3.0 Application on Windows NT Server maintaining a connection to a SQL Server 2000 database on the same machine. When an error occurs, I'd like to be able to determine whether the...
1
by: John | last post by:
When I ping my server over the internet connection and the server isn't responding due to the connection not working properly is it possible in .Net to reconnect the connection if the ping is...
0
by: mkahn | last post by:
Fater leaving my computer for a few minutes. I tried to continue working with the page am on. Seems to be that after my connection timed out, am not able to reconnect to the data base getting the...
2
by: Robert Dufour | last post by:
My functions or subs that connect to my databases are always using the following code pattern (Vs2003) Private Mysub () Dim MyConn as new Odbc.connection MyConn.ConnectionString = g_ODBCConnStr...
9
by: Big Daddy | last post by:
We have a problem where the session is getting abandoned for no apparent reason. It's not timing out. We save some important data in the Session object. The user will click on something, causing a...
1
by: terron | last post by:
I'm trying to make something that once it is disconnected will automatically try to reconnect. I'll add some more features in later so it doesn't hammer the server but right now I just want to keep...
0
by: ofer1 | last post by:
I have user with 3 open session in disconnected state on the same server. I have the sessionid for each remote session with 'qwinsta' command. Is it possible to reconnect to specific session by...
0
by: Dreea | last post by:
Hello everybody I am working on a client application that connects to a C# server using the Socket class. I am trying to handle the case in which the server goes offline, and I would like the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.