Wednesday, March 7, 2012

RDA Question

Hi All

Wondering if someone can answer a couple of quick questions.

I have a vb 2005 winforms application that uses SQL CE database and uses RDA to pull data from a SQL 2005 database and also to push back the changes. I would like to be able to advise the user if the connection to the SQL 2005 database is available and make either the push button or the pull button available depending on the state of the local or remote database.

Any suggestions on how I can do this. I have tried the following which works sort of ok but the timeout when it can't open the connection is too long.

PrivateSub checkserver()

Dim connectionstatus AsNew SqlConnection(My.Settings.MyRemoteConnectionString)

Try

connectionstatus.Open()

label2.text = "Connected"

Catch ex As Exception

Label2.Text = "Disconnected"

Button5.Enabled = False

Button6.Enabled = False

Finally

connectionstatus.Close()

EndTry

EndSub

Also I'm not sure of a way to determine which database is the most recent to enable either the push or pull buttons.

Appreciate any assistance.

Regards

Ian

You could add "Connection Timeout=5" to MyRemoteConnectionString (5 seconds instead of 15)

|||

Thanks, much better.

Any ideas about how I can determine the last time either database was edited/updated?

Ian

|||If you are using RDA, you must implement a scheme to track these changes yourself, as no information about server state is available when using RDA. I you are tracking changes locally, you might be able to get some information from the replication system tables in the SQL CE database. Maybe you should consider Merge replication, which allows you to track changes both server side and client side.

No comments:

Post a Comment