Connections Issues??

A

al

Greetings,

-ow can I let connection obj. stops after certain no. of seconds. The
propt. time out seems not to be working with me. I set the timeout to
5 seconds, but connection takes forever, if no matching database found
in the server, compare to the databse protp in the connec. obj.

-In MDI app, what ist the best appro to dealing with dataset. Should
I clear or reset the dataset when app. closes????


MTIA,
Grawsha
 
M

Miha Markic

Hi al,

al said:
Greetings,

-ow can I let connection obj. stops after certain no. of seconds. The
propt. time out seems not to be working with me. I set the timeout to
5 seconds, but connection takes forever, if no matching database found
in the server, compare to the databse protp in the connec. obj.

I guess the connectiontime refers to negotiating time with server (when one
is found).
I doubt that it applys to time when connection object is looking for server.
-In MDI app, what ist the best appro to dealing with dataset. Should
I clear or reset the dataset when app. closes????

No need to do anything.
 
W

William Ryan

Grawsha:

If I understand your objective, you don't want the connection to keep trying
to connect indefinitely. If the default timeout isn't doing it, there may
be some other problem. Can you look at the server and see if anything is
trying to open it? For instance, you may have access to the server but not
the database in question although I doubt this would exhibit the behavior
you are seeing.

There's an event called the StateChange for your connection object. If you
wire in a handler for it, you should see it fired when a connection is made
and again when it's closed. I don't recommend this approach, but for
diagnostics you would fire a timer when the connection opens and if it
doesn't close after x seconds, close it.

As far as it closing....Miha is right, you don't need to do anything. I add
one remark though..if the app can close without submitting the changes to
the Database, you may want to build in a mechanism to capture those changes
so they are lost. YOu can use DataSet.WriteXML with the diffgram option,
then deserialize t when your app opens the next time. If there are changes,
submit them.

The approach really depeds on the nature of your app though.

HTH,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top