set c = createobject("vb6soap.calc")for i = 1 to 10 wscript.echo i & " " & c.add(i,i) & " " & timenext
using system;using system.reflection;using system.runtime.interopservices;using system.enterpriseservices;using system.data;using system.data.sqlclient;[assembly: applicationname("sctrans")][assembly: applicationactivation(activationoption.server, soapvroot="sctrans")][assembly: assemblykeyfile("sctrans.snk")]namespace sctrans{ public interface isctrans { string countup (string key); } [objectpooling(minpoolsize=0, maxpoolsize=25)] [justintimeactivation(true)] [classinterface(classinterfacetype.autodual)] [transactionattribute(transactionoption.requiresnew)] public class sctranssqlnc : servicedcomponent, isctrans { [autocomplete] public string countup (string key) { _command = new sqlcommand("", _connection); _command.commandtype = commandtype.text; _command.connection.open(); _command.commandtext = "update callcount with (rowlock) set callcount = callcount + 1 where machine='" + key + "'"; _command.executenonquery(); _command.connection.close(); _numcalls++; return (_numcalls + " nc " + _guid); } protected override bool canbepooled() { return true; } private int _numcalls = 0; private string _guid = guid.newguid().tostring(); private sqlconnection _connection = new sqlconnection("user id=myuser;password=my!password; database=soaptest;server=myserver"); private sqlcommand _command; }}
新闻热点
疑难解答