编程经验总结

原创 2006年06月09日 16:33:00

一、 VBS

1.      周期调用

tmpTimer = setInterval("CheckImport()", 100)

clearInterval(tmpTimer)

2.        recordset对象

Set RsDetail = server.CreateObject("ADODB.Recordset")

RsDetail.Close

Set RsDetail. = nothing

IsObject(Rs_Media_Field):判断对象是否实列

Rs_Media_Field Is Nothing : 判断对象是空为空值

Rs_Media_Field.recordcount < 1 :判断记录集记录不为空

3.        fso对象

Set Fso1  = CreateObject("Scripting.FileSystemObject")

If Not Fso1.FolderExists(tmpFilePath) Then

Fso1.CreateFolder tmpFilePath

Set a = Fso1.OpenTextFile(SelFile.path, 1, False)   ‘a :stream

Do While Not a.atEndOfStream

linetext = a.readline

4.        execl对象

Set xlsobj = CreateObject("excel.application")

xlsFilename = ""& Downloadpath & "/Taiwan/Sy_Sov_import.xlt"

xlsobj.Workbooks.Open (xlsFilename)

xlsobj.Visible = FALSE

Call xlsobj.Run("GetImportData", fileEndLine,ObjExcel,rsData,rsTableName)

5. ado对象

Set conn = CreateObject("ADODB.Connection")

     Set comm = CreateObject("ADODB.Command")

     conn.CursorLocation = adUseClient

     conn.Open Session("sConnString")

     Set comm.ActiveConnection = conn

     comm.CommandTimeout = 60

     comm.CommandText = "USP_RO_BookOrder_Post_BySchedule"

     comm.CommandType = adCmdStoredProc

comm.Execute

Set comm = Nothing

     conn.Close

     Set conn = Nothing

6.   table 对象中新增行

Set myNewCell = SupplierTable.rows(SupplierTable.rows.length-1).insertCell()

myNewCell.id="tdNo"

myNewCell.align="Left"

myNewCell.innerHTML="<span id='spNo'>" & inr & "</span>"

 

 

7.      Select Case 语句

     Select Case Trim(byField.value)

         Case "MediaType"

              strCode = "MediaTypeCode"

              strName = "MediaTypeCode"

         Case "Channel"

              strCode = "ChannelCode"

              strName = "ChannelName"

         Case "Supplier"

              strCode = "SupplierCode"

              strName = "SupplierName"

         Case "Market"

              strCode = "MarketCode"

              strName = "MarketName"

     End Select

8.      Select中增加option

         Set aOption = document.createelement("Option")

         aOption.Text = Trim(source.Options(i).Text)         

          target.Options.Add aOption

9.      RDO远程对数据对象

<object classid=" CLSID:BD96C556-65A3-11D0-983A-00C04FC29E36" height="1" id="ADS" width = "1" ></object>

this.plan_summary = ADS.CreateObject("planning_schedule_server.summary",this.rdsip);

10.回车符:vbcrlf

二、 Javascript

1.      打开窗口

window.showModalDialog();

        var returnVal = window.showModalDialog("RO_BookingOrder_PostResult.asp", self, "dialogWidth:650px; dialogHeight:500px; status:no; scroll:no");

var G_srcWindow = window.dialogArguments;  //访问打开窗口的窗口

 

var oPop = window.open(/"WebPages/Forms/MainFrame/Main.aspx/", /"MyMedia/", /"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes/");

oPop.moveTo(0, 0);

oPop.resizeTo(screen.width, (screen.height - 30));

 

2.      隐藏控件

row_select.style.display='none';

row_select.style.display='';

3.      全屏打开窗口

window.open(parValue,"win1","scrollbars=1,status=1,resizable=1,top=0,left=0,height=" + window.screen.height + ",width=" + window.screen.width);

 

window.opener.AddProduct() :调用打开窗口中的事件

4.      定时刷新

window.setTimeout("window.frmPost.submit()", 200);

5.      XML服务

oXmlHttp = new ActiveXObject('Microsoft.XMLHttp')

oXmlHttp.onreadystatechange=initCategory; oXmlHttp.open('POST','http://trash/xmldata/xmlcategories.aspx',true); oXmlHttp.setRequestHeader("Content-Length",0); oXmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded"); oXmlHttp.send();

oXmlHttp.readyState==4

oXmlHttp.status==200

oXmlDom = new ActiveXObject('Microsoft.XMLDOM')

6.动态加载事件到控件上

<script event=onclick for=cmdSearch language="javascript">

tdc_TargetCode.DataURL ="tdc_MapTarget.asp;

tdc_TargetCode.Reset()  ;

</script>

<table id=TargetCodetable datasrc=#tdc_TargetCode>

<thead>

<tr bgcolor="#ccccff" class="cssAlternatingCell02" height="30" align=middle>

<td width="40">Select</td>

<td>Target Code</td>

<td>Target Name<input type="hidden" name="txtpagecount" >

<input type="radio"  style="DISPLAY: none"   name="pageradio">

</td></tr>

<tr bgcolor="#ffffff" id=TargetCoderows align="middle" >

<td width="40"><input type="radio"   name="TargetCoderadio" onclick="SetText()">

</td>

<td><div dataFld="Targetcode" ></div></td>

<td> <div dataFld="Targetname" ></div> <input type="hidden" dataFld=PageCount name="txtpagecount" ></td>

</tr>

</table>

7.动态生成控件

oOption       = document.createElement("OPTION");

oOption.text  = text;

oOption.value = value;

8. 根据分辨率来确定位置

<div id="inputunit" style="HEIGHT: 115px; LEFT: Expression((screen.width - 778) / 2 + 468); POSITION: absolute; TOP: 261px; WIDTH: 220px; Z-INDEX: 3">

10.   窗体返回值

val = retVal ;    

window.returnValue =   retVal ;

11.    <a>控件可触发两个事件

<a href="javascript: DeleteItem() ; "

language="javascript" onclick="return ConfirmDelete()">

<img src="images/itemDelete.gif" border="0" alt="Delete this item">

</a>

12.   javascript 中访问 控件

document.all.txtClient.value  : txt控件的值

typeof(document.all.drpCurrency) != "undefined"    //判断是否有定义

document.all("frmTitle").style.display="none"   : frmTitle<body>内的一个<td>

 

var el = window.event.srcElement;  //得到触发事件的控件

13.   Div 加滚轮

<div id="div1" style=" width: 100%; height: 100%; overflow:auto;">

<div id=div0  style="width: 100%; height:expression(screen.height - 138); overflow: auto;">

 

14.   动态创建控件

drag = document.createElement("DIV");

document.body.insertBefore(drag);

15.    框架间的方法调用

parent.frames('middleFrame').HideTree('FinancialEnquiry')

16.    访问table中某行某列的值

PowerTable.rows[0].children[i]

//PowerTable.rows[0].[i]

cellIndex 单元格的列号 , rowIndex行号

17.   定义页面装载事件

function window.onload(){}

18.   间隔执行方法

     window.setTimeout(OpenWindow, 1000); //只执行一次

     window. setInterval(OpenWindow, 1000); //每隔一段时间执行一次

19.    

 

 

 

 

 

       

             

三、 C#

1.类:System.Web.Services.Protocols.SoapHttpClientProtocol

Invoke():远程异部调用WebService

2. SoapHttpClientProtocol属性定义

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetSFileData", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

3.Excel输出(aspx页面以excel形式输出)

          Response.ContentEncoding = System.Text.Encoding.GetEncoding(utf-8);//

          Response.ContentType = "application/vnd.ms-excel";

Response.Charset =utf-8;

4.服务器的机器名与域名获取

Server.MachineName

Request.ServerVariables["HTTP_HOST"] //带端口号

5.获取服务器控件呈现在HTML后的控件名

btnName.ClientID

6. 属性动态加载客户端事件

imgBtnChn.Attributes["onclick"] = "return imgSuppliers()";

     7. 定义事务

         SqlTransaction myTrans=null;

         sqlCon.Open();

         myTrans=sqlCon.BeginTransaction();

SqlCommand sqlCmd=new SqlCommand(strSQL,sqlCon);

sqlCmd.Transaction=myTrans;

sqlCmd.ExecuteNonQuery();

myTrans.Commit();

8. GridView 对象

          AutoGernateColumns 属性:根据datasource自动生成columns

9. ClientScriptManager 对象

         ClientScript.RegisterStartupScript(typeof(Page),"Pass", strScript)

   //Registers the startup script with the Page object

10.String Format功能

string sql = string.Format("Select *,isnull( DateDiff(mi, getDate(),ExpireDate) , 0) as dt from [cd_us_user] myUser Where Uid = '{0}'", uID);

11. 二维数组的定义

             int[] a = new int[] { 1 ,2 ,3 };

             int[ , ] b = new int[ ,] { { 1, 1, 1 }, { 2, 2, 2 } };//二维数组

int[][] c = new int[][] { new int[]{ 1, 2, 3 }, new int[]{ 1,2,3,4} }; //数组的数组

    int[][] d = new int[][] {a, a};

12.暂停paint

this.SuspendLayout();

this.ResumeLayout(false); 

13.只实例一个窗体   ----??????

只要注意,创建窗体B的时候,把原来的 new FormB(); -->换成 FormB frm = FormB.CreateInstance;就可以了,这样可以在当前进程中,保证窗体B的实例,只有一个.

14. 休眠

          // 休眠以在中断发出时捕捉中断。
          System.Threading.Thread.Sleep(100);                                               

15. GridView中的数据绑定

<%# DataBinder.Eval(Container.DataItem,"ClientDepartmentID") %>

16.ReadOnly 属性的BUG

在给TextBox 控制的属性给ReadOnly 属性如 TextBox tb.ReadOnly = True ;时,后台将不能访问该TextBox.Text属性,客户端给值后将无法在服务器端识别。

          改用客户端赋值:tb.Attribute[ReadOnly] = ture

四、 VB.NET

1.        邮件发送

Dim smtp As String = PublicInterfaceIMIX.strSmtpServer

Dim mailto As String() = PublicInterfaceIMIX.strMailTo.Split(";")

If mailto.Length < 1 Then Return '如果没有设置接收的邮箱则不发送邮件

Dim mailfrom As String = PublicInterfaceIMIX.strMailFrom

Dim subject As String = "[SAPInterface Notification]From " + PublicInterfaceIMIX.strCountry

Dim content As String = "dear all,<br>We've not received ftp file(s) from SAP today.<br>" + DateTime.Now.ToString("F")

Dim myMail As MailMessage = New MailMessage()

myMail.From = mailfrom

myMail.To = mailto(0)

Dim i As Integer

For i = 1 To mailto.Length - 1

myMail.Cc = mailto(i)

Next

myMail.Subject = subject

myMail.BodyFormat = MailFormat.Html

myMail.Body = content

SmtpMail.SmtpServer = smtp

SmtpMail.Send(myMail)

End If

2.        多线程的调用方法

         If PublicInterfaceIMIX.strStartOption = "1" Then 

            IMIXToSAP = New Thread(AddressOf IMIXToSAPStart)

            IMIXToSAP.Start()

        ElseIf PublicInterfaceIMIX.strStartOption = "2" Then

            SAPToIMIX = New Thread(AddressOf SAPToIMIXStart)

            SAPToIMIX.Start()

         ElseIf PublicInterfaceIMIX.strStartOption = "3" Then

            IMIXToSAP = New Thread(AddressOf IMIXToSAPStart)

            SAPToIMIX = New Thread(AddressOf SAPToIMIXStart)

            SAPToIMIX.Start()

            IMIXToSAP.Start()

         End If

五、  HTML

1.控件

1) <INPUT id=txtVendor name=txtVendor style="HEIGHT: 22px; WIDTH: 80px" readonly>

2) <INPUT id=cmdVendor name=cmdVendor style="HEIGHT: 22px; WIDTH: 20px" type=button value=...>

3) <SELECT  id=selMediaType class="cssInputBoxPicker" name=selMediaType style="HEIGHT: 22px; WIDTH: 110px">

<OPTION selected></OPTION>

</SELECT>

2.将一页面的输出做为另一页面的数据源

<table width=1200 border="0" id=OrderData dataSrc=#SearchOrder>

<tr align="left" bgcolor="#e8e8e8"  >

<Td><input type="checkbox" name="chkbox" id=checkMark onclick="javascript:set_Select()" >

<input type="hidden" name="hidden1" id="PageNo" dataFld="PageNo">

</td><td>

<div dataFld="OrderNo"></div>

<input type="hidden" id="orderno" dataFld="OrderNo">

<input type="hidden" id="Order_ID" dataFld="Order_ID">

</td><td >

<div dataFld="OrderVersion"></div>

<input type="hidden" id="orderversion" dataFld="OrderVersion">

</td>

<td ><div dataFld="ClientCode"></div></td>

<td ><div dataFld="ProductCode"></div></td>

<td><div dataFld="SupplierCode"></div></td>

<td ><div dataFld="Market"></div></td>

<td ><div dataFld="MediaTypeCode"></div></td>

<td ></tr>

</table>

<script language=javascript>

function findit(inaction){

SearchOrder.dataurl="tdc_SearchOrderTransfer.asp "

SearchOrder.reset();

}

</script>

/* tdc_SearchOrderTransfer.asp页面*/

<%@ Language=VBScript %>

<%

response.expires = 0

response.expiresabsolute = Now() - 1

response.addHeader "pragma","no-cache"

response.addHeader "cache-control","private"

Response.CacheControl = "no-cache"

response.buffer=0

%>

Set conn = server.CreateObject("adodb.connection")

Set rs = server.CreateObject("adodb.recordset")

Set rs2 = server.CreateObject("adodb.recordset")

conn.Open session("sConnString")

sql = "select t1.Order_ID,t1.OrderNo, t1.OrderVersion,t1.ClientCode,t1.ProductCode,

t1.SupplierCode,t1.Market,t1.MediaTypeCode,t1.ChannelCode,t1.StartDate,t1.EndDate,

t2.user_name  from Order_Master t1  "

sql = sql & " left join UserAdmin.dbo.USERS t2 on t2.USER_ID=t1.createby where 1=1 "

rs.Open sql, conn, 3

If Not rs.EOF Then

rs.AbsolutePage = CInt(inpageno)

response.write "Order_ID,OrderNo,OrderVersion,ClientCode,ProductCode, SupplierCode,Market,MediaTypeCode,ChannelCode,StartDate,EndDate,UserName,PageNo"

response.write Chr(10)

For i = 1 To rs.pagesize

If rs.EOF Then Exit For

tmpproduct = Trim(rs("ProductCode"))

tmpclient = Trim(rs("ClientCode"))

tmpproduct = iif(InStr(tmpproduct, ",") > 0, Replace(tmpproduct, ",", "/"), tmpproduct)

tmpclient = iif(InStr(tmpclient, ",") > 0, Replace(tmpclient, ",", "/"), tmpclient)

response.write CStr(rs("Order_ID")) & "," & CStr(rs("OrderNo")) & "," & CStr(rs("OrderVersion")) & "," & tmpclient & "," & tmpproduct & "," & Trim(rs("SupplierCode")) & "," & Trim(rs("Market")) & "," & Trim(rs("MediaTypeCode")) & "," & Trim(rs("ChannelCode")) & "," & rs("startdate") & "," & rs("enddate") & "," & rs("user_name") & "," & rs.pagecount

response.write Chr(10)

rs.movenext

Next

 

End If

六、 .NET2005

1. Generics Class :(通用类)

// Declare the generic class

public class MyList<T>

{....//  }

// Declare a list of type int

MyList<int> list1 = new MyList<int>();

// Declare a list of type string

MyList<string> list1 = new MyList<string>();

// Declare a list of type MyClass

MyList<MyClass> list1 = new MyList<MyClass>();

2.        客户端取dropdownlist

obj.options[obj.options.selectedIndex].value //obj dropdownlistID

3.         

 

七、 应用

1.outlook放入托盘

工作中常常打开很多窗口和应用程序,这样任务栏中就显得比较拥挤,而Microsoft Outlook软件又是必须打开的软件,有什么办法让它只显示系统托盘中呢?
    1)
打开注册表编辑器:开始-运行:输入regedit
    2)
找到“HKEY_CURRENT_USER/Software/Microsoft/Office/10.0/Outlook/Preferences”键值,然后右击空白区域,新建一个DWORD“MinToTray”,并设键值为1
    3)
重新启动Microsoft Outlook软件,然后点击最小化按钮。
    Microsoft Outlook
软件是不是跑到系统托盘中去了?如果再配置一下新邮件到达时给出通知设置,那就不用时不时去查看邮件了。
 

2. Dreamweaver中出现乱码,大致为两种情况:

  一是没有标明主页制作所用的文字,这种情况下很简单就可以解决,加上说明即可。

  二是你新加装了字体,(诸如文鼎酷字体之类),这样你每次新建一个网页,都要调整一次,非常麻烦。那么你可以用下面的方法解决。

  请先备份注册表,退出运行中的Dreamweaver

  1.运行regedit.exe

  2.找到HKEY_CURRENT_USER/SOFTWARE/MACROMEDIA/DREAMWEAVER 4/FONT PREFERENCES

  接下来有2个方案:

  简便方案:

  双击Number Encodings,把数值b改成c(十进制的11改成12);退出regedit,进入Dreamweaver,现在你就可以随意地选择PROPOTIOANLFIXED FONTCODE INSPECTOR的字体和文字大小了!

  完美方案:

  为什么简便方案还不够呢?因为仅做上述改动,就只能选择中文字体,而有些情况下,一些英文字体会比中文字体好看(比如我在CODE INSPECTOR里面就选用ARIAL字体,比宋体、仿宋什么的要好看多了),而且对中文部分也能正确显示。

  方法如下:

  在HKEY_CURRENT_USER/SOFTWARE/MACROMEDIA/DREAMWEAVER 4/FONT PREFERENCES下,双击Number Encodings,把数值b改成c(十进制的11改成12);进入CharEncoding_11,对内部数值进行修改:

  注意最好只改动以下值:

  Fixed Name :字体名称

  Fixed Size :字体大小

  HTML inspector font :字体名称

  HTML inspector font size :字体大小

  Proportional Name :字体名称

  Proportional Size :字体大小

  如果感到不满意,也可尝试把:Fixed CharSetProportional CharSetWindows Character Set86(十进制的134,表示中文)改成00(代表英文)

  对于简便方案,这里还有一个更简单的实现方法,把以下代码复制下来,保存成为一个后缀是.reg的文件(要注意一定要为纯文本方式),然后执行这个reg文件,修改就会自动完成(也请先备份注册表)

  REGEDIT4 [HKEY_CURRENT_USER/Software/Macromedia/Dreamweaver 4/Font Preferences] "Number Encodings"=dword:0000000c"Default Encoding"=dword:00000005

3.        Dos 命令

Ping  –a  ip :  可以查看该计算机的电脑名

 

 

 

八、 WSE3.0

九、 WebService

1.        加密,解密

需要引用DataSetSurrogate.dll,在网上可以下到

Web Service端加密

[WebMethod]

public byte[] ReSerializeDataSet()

{

this.sadp.Fill(this.ds);

this.ds.Tables[0].TableName="table1";

this.ds.Tables[1].TableName="table2";

DataSetSurrogate sds=new DataSetSurrogate(this.ds);

MemoryStream ms=new MemoryStream();

BinaryFormatter fb=new BinaryFormatter();

fb.Serialize(ms,sds);

byte[] e=ms.ToArray();

return e;

}

=============================================================================Windows Application端解密

public DataSet GetDataSet()

{

DataSet ds=new DataSet();

DataSetSurrogate sds;

BinaryFormatter bf=new BinaryFormatter();

MemoryStream ms;

byte[] e=null;

ReturnDataSet rds=new ReturnDataSet(ConfigurationSettings.AppSettings["url"]);

rds.Credentials=System.Net.CredentialCache.DefaultCredentials;

e=rds.ReSerializeDataSet();

ms=new MemoryStream(e);

object o=bf.Deserialize(ms);

sds=(DataSetSurrogate)o;

ds=sds.ConvertToDataSet();

ms.Close();

return ds;

}

2.        调用

2.1)客户端javascript

//Test function with get method.

function RequestByGet(data){

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

//Webservice location.

var URL="http://localhost:1323/WebSite6/Service.asmx/SayHelloTo?Name=Zach";

xmlhttp.Open("GET",URL, false);

xmlhttp.SetRequestHeader ("Content-Type","text/xml; charset=utf-8");

xmlhttp.SetRequestHeader ("SOAPAction","http://tempuri.org/SayHelloTo");

xmlhttp.Send(data);

var result = xmlhttp.status;

//OK

if(result==200) {

document.write(xmlhttp.responseText);

}

xmlhttp = null;

}

//Test function with post method

function RequestByPost(value)

{

var data;

data = '<?xml version="1.0" encoding="utf-8"?>';

data = data + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';

data = data + '<soap:Body>';

data = data + '<SayHelloTo xmlns="http://tempuri.org/">';

data = data + '<Name>'+value+'</Name>';

data = data + '</SayHelloTo>';

data = data + '</soap:Body>';

data = data + '</soap:Envelope>';

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

var URL="http://localhost:1323/WebSite6/Service.asmx";

xmlhttp.Open("POST",URL, false);

xmlhttp.SetRequestHeader ("Content-Type","text/xml; charset=gb2312");

xmlhttp.SetRequestHeader ("SOAPAction","http://tempuri.org/SayHelloTo");

xmlhttp.Send(data);

document.write( xmlhttp.responseText);

}

2.2)动态调用

/// <summary>

         /// 根据指定的信息,调用远程WebService方法

         /// </summary>

         /// <param name="url">WebServicehttp形式的地址</param>

         /// <param name="namespace">欲调用的WebService的命名空间</param>

         /// <param name="classname">欲调用的WebService的类名(不包括命名空间前缀)</param>

         /// <param name="methodname">欲调用的WebService的方法名</param>

         /// <param name="args">参数列表</param>

         /// <returns>WebService的执行结果</returns>

         /// <remarks>

         /// 如果调用失败,将会抛出Exception。请调用的时候,适当截获异常。

         /// 异常信息可能会发生在两个地方:

         /// 1、动态构造WebService的时候,CompileAssembly失败。

         /// 2WebService本身执行失败。

         /// </remarks>

         /// <example>

         /// <code>

         /// object obj = InvokeWebservice("http://localhost/GSP_WorkflowWebservice/common.asmx","Genersoft.Platform.Service.Workflow","Common","GetToolType",new object[]{"1"});

         /// </code>

         /// </example>

         private object InvokeWebservice(string url, string @namespace, string classname, string methodname, object[] args)

         {

              try

              {

                   System.Net.WebClient wc = new System.Net.WebClient();

                   System.IO.Stream stream = wc.OpenRead(url+"?WSDL");

System.Web.Services.Description.ServiceDescription sd = System.Web.Services.Description.ServiceDescription.Read(stream);

System.Web.Services.Description.ServiceDescriptionImporter sdi = new System.Web.Services.Description.ServiceDescriptionImporter();

                   sdi.AddServiceDescription(sd,"","");

System.CodeDom.CodeNamespace cn = new System.CodeDom.CodeNamespace(@namespace);

                   System.CodeDom.CodeCompileUnit ccu = new System.CodeDom.CodeCompileUnit();

                   ccu.Namespaces.Add(cn);

                   sdi.Import(cn,ccu);

Microsoft.CSharp.CSharpCodeProvider csc = new Microsoft.CSharp.CSharpCodeProvider(); System.CodeDom.Compiler.ICodeCompiler icc = csc.CreateCompiler();  System.CodeDom.Compiler.CompilerParameters cplist = new System.CodeDom.Compiler.CompilerParameters();

cplist.GenerateExecutable = false;                 cplist.GenerateInMemory = true;           cplist.ReferencedAssemblies.Add("System.dll");               cplist.ReferencedAssemblies.Add("System.XML.dll");           cplist.ReferencedAssemblies.Add("System.Web.Services.dll");           cplist.ReferencedAssemblies.Add("System.Data.dll");                    System.CodeDom.Compiler.CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu);                 

if(true == cr.Errors.HasErrors)

{

                       System.Text.StringBuilder sb = new System.Text.StringBuilder();

                       foreach(System.CodeDom.Compiler.CompilerError ce in cr.Errors)

                       {

                            sb.Append(ce.ToString());

                            sb.Append(System.Environment.NewLine);

                       }

                       throw new Exception(sb.ToString());

                   }

                   System.Reflection.Assembly assembly = cr.CompiledAssembly;

                   Type t = assembly.GetType(@namespace+"."+classname,true,true);

                   object obj = Activator.CreateInstance(t);

                   System.Reflection.MethodInfo mi = t.GetMethod(methodname);

                   return mi.Invoke(obj,args);

              }

              catch(Exception ex)

              {

throw new Exception(ex.InnerException.Message,new Exception(ex.InnerException.StackTrace));

              }

         }

2.3) ASP中调用

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

<%

Dim strxml

Dim str

'定义soap消息

strxml = "<?xml version='1.0' encoding='tf-8'?>"

strxml = strxml & "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"

strxml = strxml & "<soap:Body> "

strxml = strxml & "<isNumner xmlns='http://tempuri.org/myService/test'>"

strxml = strxml & "<str>4</str>"

strxml = strxml & "</isNumner>"

strxml = strxml & "</soap:Body>"

strxml = strxml & "</soap:Envelope>"

'定义一个XML的文档对象,将手写的或者接受的XML内容转换成XML对象

'set x = createobject("Microsoft.DOMDocument")

'初始化XML对象

'将手写的SOAP字符串转换为XML对象

' x.loadXML strxml

'初始化http对象

Set h = createobject( "Microsoft.XMLHTTP")

'向指定的URL发送Post消息

h.open "POST", "http://localhost/myService/test.asmx", False

h.setRequestHeader "Content-Type", "text/xml"

h.setRequestHeader "SOAPAction", "http://tempuri.org/myService/test/isNumner"

h.send (strxml)

While h.readyState <> 4

Wend

'显示返回的XML信息

str = h.responseText

'将返回的XML信息解析并且显示返回值

'Set x = createobject("MSXML2.DOMDocument")

' x.loadXML str

'str = x.childNodes(1).Text

response.write(str)

%>

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

编程经验总结

C编程经验总结4

C编程经验总结4 {}体里的语句不管在一行还是在多行,之间都是要有; for与for之间可以是独立的,也可以是相互嵌套的 For( ; i 一般都是在循环里面进行判断,比如for里的if F...

CSDN --- VC编程经验总结.rar

  • 2010-09-14 23:14
  • 760KB
  • 下载

CSDN,VC编程经验总结

  • 2009-08-12 09:14
  • 772KB
  • 下载

C编程经验总结3

#define语句后面无; 八进制前面有0 如010是8 十六进制必须0x 如0x10是16 6u表示无符号数                &...

c++ 编程经验总结

  • 2009-07-29 20:37
  • 772KB
  • 下载

VisualC++ 编程经验总结

  • 2008-10-28 11:16
  • 763KB
  • 下载

关于QtGraphics编程的几点经验总结_qgraphicsscene

QtGraphics主要由三部分组成,分别是View,Scene, Item。

VC编程经验总结.chm

  • 2008-04-19 23:23
  • 772KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)