Re: Connection trough MarshalByRefObject

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



RecordSet? Do you use ADO (the old COM object)? Why?

OK, if you insist using ADO, rather than ADO.NET for your special reason,
that is fine. However, you cannot use ADO.NET's SqlConnection object for
opening ADODB.RecordSet. You need a ADODB.Connection.


"Krys" <it@xxxxxxx> wrote in message
news:op.tkivvxoakno4s0@xxxxxxxxxxxxxxxxxxx

When i invoke a method (which tries to create a database query) from
client on server, server throws COMException.

this code is in dll used by server and client:
public class zdalne_objekty : MarshalByRefObject
{
public string testowa()
{
Recordset wynik = new Recordset();
SqlConnection conn = new SqlConnection("User ID=sa;Initial
Catalog=test;Data Source=KRYSW\\INSERTGT;Packet Size=4096;Workstation
ID=KRYSW");
wynik.Open("SELECT * FROM tabelka", conn,
ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockUnspecified,8);
return "test";
}

code from client:
TcpChannel c = new TcpChannel();
ChannelServices.RegisterChannel(c, true);

object zdalny_objekt =
Activator.GetObject(typeof(zdalne_objekty), "tcp://localhost:10500/Objekt
zdalny.tcp");
zdalne_objekty zdal = (zdalne_objekty)zdalny_objekt;
string ds = zdal.testowa();


when i use method testowa() local on serwer, everything works fine.
what is wrong? why doesnt it work from client trough network?


.



Relevant Pages

  • Re: DAO to ADO Recordset Options
    ... DAO was really fast when dealing with Access data (faster than ADO) but was ... Recordset. ... For client-sided cursors, there is only Static cursor type regardless as ... determines how often data is fetched from the server. ...
    (microsoft.public.data.ado)
  • Pessimistic locking with approles.
    ... It now uses ADO, server side cursors, application roles, ... say you have an ADO recordset open on a table Employee ... (Pessimistic locking requires a server side cursor.) ...
    (microsoft.public.sqlserver.security)
  • Re: ADO Data Control Concurrency Problem
    ... >> Editing of row in table is done with the help of ADO Data Control. ... Cursor location does not bare on whether the ... Client or Server memory. ... reflected in the open recordset. ...
    (microsoft.public.vb.general.discussion)
  • Re: DCOM and ADODB.RecordSet
    ... I have a client EXE on a user's PC connecting to a variety ... of DLLs running on a separate server using DCOM. ... Since you are marshaling the Recordset cross-process you must pass it ByVal. ...
    (microsoft.public.vb.com)
  • Re: Slow Stored Procedure when run via ado, fast from query analyzer
    ... > about 2 seconds from query analyzer, and takes 50+ seconds run from ADO ... If a Recordset - have you checked to see CursorLocation, CursorType, ... Server vs Client, it should be the same ballpark in magnitude. ...
    (microsoft.public.data.ado)