|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Connection trough MarshalByRefObjectclient 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 =3D new Recordset(); SqlConnection conn =3D new SqlConnection("User ID=3Dsa;Init= ial = Catalog=3Dtest;Data Source=3DKRYSW\\INSERTGT;Packet Size=3D4096;Workstat= ion = ID=3DKRYSW"); wynik.Open("SELECT * FROM tabelka", conn, = ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockUnspecified,= 8); return "test"; } code from client: TcpChannel c =3D new TcpChannel(); ChannelServices.RegisterChannel(c, true); object zdalny_objekt =3D = Activator.GetObject(typeof(zdalne_objekty), "tcp://localhost:10500/Objek= t = zdalny.tcp"); zdalne_objekty zdal =3D (zdalne_objekty)zdalny_objekt; string ds =3D zdal.testowa(); when i use method testowa() local on serwer, everything works fine. what is wrong? why doesnt it work from client trough network? 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" <i*@is.fake> wrote in message When i invoke a method (which tries to create a database query) fromnews:op.tkivvxoakno4s0@krysw.wrocek.net... 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? On Thu, 14 Dec 2006 15:30:35 +0100, Norman Yuan <NotR***@NotReal.not>
wrote: > RecordSet? Do you use ADO (the old COM object)? Why? I used ADODB.Connection too, works either not.> > 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. > Second if i run this code local from server (not remote from client) it works fine... |
|||||||||||||||||||||||