Tuesday, March 6, 2012

.net and Sql Express

Hi all, I have written a simple .net class to call sql functions like create subscription and sync replication. I am using merge replication. My Question is this:-- my class calls Microsoft.SqlServer.Replication.dll. On a machine that has SQL Express loaded it works but on a machine that does not have sql express it fails. I have made a setup project and deployed my "service". I added all references into the project and all works well on a machine that has sql express. We are running a network with 1 machine that has sql express and other machines that plug into this sql express. Is there a sql express runtime setup or do I have to load sql express on each machine. OR Am I deploying my class wrong. my setup project has the Microsoft.SqlServer.Replication.dll under detected dependencies but not any where else. Do I need to add it as reference. Tried Under Properties of Microsoft.SqlServer.Replication.dll in setup project Register : vsdraCOMRelativePath / vsdraCOM Exclude : False All the dlls I use are deployed to the install directory but gives Error "could not load dll or assembly SqlServer.Replication" Cheers

I havn't use replication with express yet, but yu might want to install the sqlnative client onto the client machines. You can get this download from the microsoft downloads site.

|||

This particular dll seems to be part of the sdk kit of sql server 2005.

directory 90\SDK\Assemblies

The sql native client did not help. I installed it and still no avail.

How would one deploy the sdk kit files

Cheers

|||

Hi Robert,

I'm not clear on why you would want to run your service on a computer that doesn't have SQL Express installed, could you explian? Replication is about communication between two SQL Servers, without a SQL Server, what exactly are you synchronizing?

Thanks for the further detail.

Regards,

Mike

|||

hi,

Mike already pointed out there's no real sens in doing what you are trying to do...

are you perhaps trying something already built-in, like Query Notifications? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/querynotification.asp, http://msdn2.microsoft.com/en-us/library/t9x04ed2.aspx

regards

|||

I am trying to have one machine that replicates to a internet based server. This one machine is on our local lan. Other users can log into our program which then connects to the local "lan" sql express. Once all work is done, a "On Demand " sync is done. I wrote the dll to perform this on demand sync.I don't want sql express installed on all 10 machines but rather on one lan machine that everyone can use.

Problem is that the dll needs the sql replication dll to function. A machine without sql express installed cannot ask for the sync via the dll.It generates an error
I have tried to include the sql replication dll in my install but it still does not want to work.I think I am registering it wrong.If I install sql express then the dll works.
(I am using VS 2005 .net setup to deploy the project dll.). This is something I am trying to avoid.
At the moment the way it has to work is that everybody does their changes and then requests a sync update from the user, who has the sql express installed, to update the replication.Quite tiresome.

Regards

Robert

|||Robert you answer lies in the application distribution. So this thread should probably be moved to Coding forum.

But anyway. I think your answer lies in remoting, using a multi-tier application.

We have a similar setup where sql exp is used as a server for two or more client applications. You will need to create Data class that run on the machine where SQL Express is installed and then use .Net Remoting from your client machines to invoke the Data class. This centralised data class will be the one that instantiates the SQL replication dll and thus it will call it from it's local machine (The Data Server). For this purpose the data server is just the machine where SQL exp is installed.

There fore the clients need know nothing about SQL Replication only that they create the remoting object and instruct the data class on the server to do the work. Hence they don't need SQL Express installed on every machine.

If you are not familiar with remoting then you will need to do quite a bit of reading up as there can be pitfalls and it may require you application to be restructured completely.

Hope this points you to your answer

Cheers
Rab
|||

Just a few question.

Why does the dll not work on its own.
Can I not simply distribute the dll.
I suppose the dll does not contain all the libary files from SQL to invoke the calls made to sql express.
Thanks anyway for the answer.

Cheers

Robert

No comments:

Post a Comment