我写了6个过程,在这6个过程中,分别去链接6个不同的webservices取数,然后我在page_load 里面这样写:protected void Page_Load(object sender, EventArgs e)
{过程1();
过程2();
过程3();
过程4();
过程5();
过程6();}那么这6个过程是依次执行还是同时执行呢?在执行第一个过程中去链接webservices的时候,另外的过程是等着还是也在链接?我有两个问题,第一个,我如何让这个网页先显示出来,然后再去执行这些函数呢?
第二个,我如何让这六个过程分别执行呢?
{过程1();
过程2();
过程3();
过程4();
过程5();
过程6();}那么这6个过程是依次执行还是同时执行呢?在执行第一个过程中去链接webservices的时候,另外的过程是等着还是也在链接?我有两个问题,第一个,我如何让这个网页先显示出来,然后再去执行这些函数呢?
第二个,我如何让这六个过程分别执行呢?
解决方案 »
- 急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!急!
- 问GRIDVIEW操作的一个问题
- Std_StranJF.js繁简体转换问题
- 急啊!数据写入问题,帮帮,忙
- 为什么我的window server 2003上部分asp程序无法运行???
- 正则表达式:怎么过滤$符号?
- 在开发中体验设计模式
- DataList绑定DataSet后如何让每一行产生一个行号?
- 请问个位高手?为什么在VS.NET中无法创建或打开web项目?高分求教?
- 一个与asp.net有关的数据库小问题
- asp.net中如何实现datagrid的内容打印
- 哪位高手帮我解决一下这条SQL语句.急!!!
{
Response.Write("过程1");
过程1();
Response.Write("过程2");
过程2();
Response.Write("过程3");
过程3();
Response.Write("过程4");
过程4();
Response.Write("过程5");
过程5();
Response.Write("过程6");
过程6(); }
所以如果第一个过程对后面没有影响的话,可以给第一个过程单独一个线程,就可以了;这样的话你的两个问题基本都可以解决;
单个调试的方法好象只有一个设置断点,依次调试!
使用try,catch
把每一个的数据集在及时窗口里面打出来!
dummythread.isbackground=true;
dummythread.name = "first thread";
dummythread.start( ); thread dummyprioritythread = new thread( new threadstart(somefunction2) );
dummyprioritythread.isbackground=true;
dummyprioritythread.name = "second thread";
dummyprioritythread.start( );
...........................
.........................
有6个就写6个
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;/// <summary>
/// TestThead 的摘要说明
/// </summary>
public class TestThead
{
public TestThead()
{
//
// TODO: 在此处添加构造函数逻辑
//
} public static void Thread_GetSumPrice()
{
DepWs02.Service sd = new DepWs02.Service(); string StrR; try
{
StrR = sd.ReturnString(strConnection, "select cast(sum((case when 行号=1 then 滞纳金 else 0 end)+实纳金额 )as numeric(18,0)) as Result " +
" from 完税证信息新 where 征收机关ID='02' and 完税证状态='缴销' and 填发日期 between '2007-01-01' and getdate()");
}
catch
{
StrR = "无链接";
}
finally
{
sd.Dispose();
}
} public static void Main()
{
ThreadStart thr_start_func = new ThreadStart(Thread_GetSumPrice);
Thread fThread = new Thread(thr_start_func);
fThread.Name = "first_thread";
fThread.Start();
}}以上是我写的一个线程的代码,我写在一个类里面,Thread_GetSumPrice是主要的代码,
Main是调用线程的代码,我想知道,我在外面某个页面上,如何调用这个线程让它开始
我如何能得到StrR的值?或者是不是需要别的方法来得到线程的返回值?
我怎么能知道这个线程死掉了,或者是执行完成了呢?