Connections Issues??

  • Thread starter Thread starter al
  • Start date Start date
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
 
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.
 
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
 
Back
Top