K
Krys
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?
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?