Greg Robinson's Blog

I report it, you decide

Click Once

Custom Authentication in Windows Forms

DataBinding Stuff

Favorite Links

My book contribution

My Book Reviews

My Personal Life

Richmond, VA .NET Users Group

Smart Client Stuff

What I am reading

SqlClient Types and remoting

I am going nuts over here.  First, I run into all kinds of remoting issues with SqlParameter types.  Now, I discover SqlConnection types are not remotable!!

 

Follow-up:  Rudi was quick to point out the passing a connection from the client is BAD!  I agree.  In my case, I pass a conncetion string to a remoted server object and then build the connection object.  I was simply testing passing the connection object, which, the more I think about it, this is not good.  SqlParameters though, I see no reason why I would have concerns passing them as a SqlParameter type from my client, unless, of course, one is concerned about switching databases in the furture, which we will not. 

 

 

Comments

Rudi said:

And how would you want to remote a SQLConnection?? This object actually has to connection from your 'server' to the database server. If you would want a SQLConnection on your client, which imho is a really bad idea, you need to create it on the client.

Why is a SQLConnection not remotable? Its an unmanaged resource so, you have no control over the memory and data that you would want to serialize and pump over the network.

And really, I would not remote any database specific types to my client. It couples your client tightly to your backend server.

I'm sure you'll learn lots more objects are not remotable, and if they are in the framework, its probably for a good reason.

Cheers
# February 24, 2003 9:57 AM