my write code is(i know that is error),how can I do?:
-------------------------------------------------------------------
ThreadArray[m]=new Thread(new ThreadStart(this.send_write_log(
ec_send_email, ec_send_name, es_email, smtp_server, email_format,
et_subject, et_content, esl_id, et_id,es_id,esl_type)));
ThreadArray[m].IsBackground=true;
ThreadArray[m].Start();
function is:
--------------------------------------------------------------------
public void send_write_log(string ec_send_email,string ec_send_name,string
es_email,string smtp_server,bool email_format,string et_subject,string
et_content,int esl_id,int et_id,int es_id,int esl_type)
{
//send Mail
string send_log="";
string code_no;
bool send_flag=false;
if(esmtp.Send(ec_send_email,ec_send_name,es_email, "",smtp_server,email_forma
t,et_subject,et_content))
{
send_log=esmtp.Logs.ToString();
send_log=cm.getEndLine(send_log); //Get End Line String
code_no=cm.getCodeNo(send_log);
send_flag=true;
}
else
{
send_log=esmtp.ErrorMessage;
code_no=cm.getErrorCodeNo(send_log);
}
send_log=cm.limitStringLength(send_log); //fix string "'" and length
int code_no_int=Convert.ToInt32(code_no);
rtb_info.SelectionColor=Color.Green;
//rtb_info.AppendText("Mail Server:"+dns_mx+"\r\n");
rtb_info.AppendText("> "+es_email+" have sent!
"+send_flag.ToString()+"\r\n");
//rtb_info.AppendText(">"+send_log);
//rtb_info.AppendText(">"+send_log.Length.ToString() );
if(esl_type!=2)
{
// write the Email send state to send log
rtb_info.AppendText("> write the "+es_email+ " send state to subscribe
send log! \r\n");
e_db_manage.addNewSubscribSendLog(esl_id,et_id,es_ id,es_email,code_no_int,se
nd_log);
}
else //on resend mail then update log
{
// write the Email send state to send log
rtb_info.AppendText("> Upstate the "+es_email+ " send state to subscribe
send log! \r\n");
e_db_manage.updateSubscribSendLog(esl_id,et_id,es_ id,code_no_int,send_log);
}
} 1 1216
Hi qushui,
ThreadStart is a parameterless delegate thus accepting only parameterless
methods.
IOW - you can't pass arguments.
Arguments should be passed in another way. One way would be to use global
varaibles.
Other way would be to put thread method into another class and put arguments
into this class' fields and then start the method.
Of course, there are other ways.
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
"qushui_chen" <qu*********@asus.com.cn> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl... my write code is(i know that is error),how can I do?: ------------------------------------------------------------------- ThreadArray[m]=new Thread(new ThreadStart(this.send_write_log( ec_send_email, ec_send_name, es_email, smtp_server, email_format, et_subject, et_content, esl_id, et_id,es_id,esl_type))); ThreadArray[m].IsBackground=true; ThreadArray[m].Start();
function is: -------------------------------------------------------------------- public void send_write_log(string ec_send_email,string ec_send_name,string es_email,string smtp_server,bool email_format,string et_subject,string et_content,int esl_id,int et_id,int es_id,int esl_type) { //send Mail string send_log=""; string code_no; bool send_flag=false;
if(esmtp.Send(ec_send_email,ec_send_name,es_email, "",smtp_server,email_forma t,et_subject,et_content)) { send_log=esmtp.Logs.ToString(); send_log=cm.getEndLine(send_log); //Get End Line String code_no=cm.getCodeNo(send_log); send_flag=true; } else { send_log=esmtp.ErrorMessage; code_no=cm.getErrorCodeNo(send_log); } send_log=cm.limitStringLength(send_log); //fix string "'" and length int code_no_int=Convert.ToInt32(code_no);
rtb_info.SelectionColor=Color.Green; //rtb_info.AppendText("Mail Server:"+dns_mx+"\r\n"); rtb_info.AppendText("> "+es_email+" have sent! "+send_flag.ToString()+"\r\n"); //rtb_info.AppendText(">"+send_log); //rtb_info.AppendText(">"+send_log.Length.ToString() );
if(esl_type!=2) { // write the Email send state to send log rtb_info.AppendText("> write the "+es_email+ " send state to subscribe send log! \r\n");
e_db_manage.addNewSubscribSendLog(esl_id,et_id,es_ id,es_email,code_no_int,se nd_log); } else //on resend mail then update log { // write the Email send state to send log rtb_info.AppendText("> Upstate the "+es_email+ " send state to
subscribe send log! \r\n");
e_db_manage.updateSubscribSendLog(esl_id,et_id,es_ id,code_no_int,send_log); } }
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Apple |
last post by:
1. I want to create an autonumber, my requirement is : 2005/0001
(Year/autonumber), which year & autonumber no. both can auto run.
2. I had create a query by making relation to a table & query,...
|
by: Kevin Chabot |
last post by:
Hi,
I need to be able to create one or more form(s) from a method that is
called from different threads. When this form is created, it appears but
it does not receive any message. It looks...
|
by: MechSoft |
last post by:
Hi, there,
I have a multi-threaded non-MFC program that will include a regular dll
which would be part of the user interface, possibly a dialog based interface.
I would prefer to have the user...
|
by: mareal |
last post by:
I have noticed how the thread I created just stops running. I have added
several exceptions to the thread
System.Threading.SynchronizationLockException
System.Threading.ThreadAbortException...
|
by: Markus Prediger |
last post by:
Hi NG,
I have an asp.net project that uses an vb6 com object for some
database-manipulation (I cannot rewrite it in .net, sorry, its not my
decision).
I want it to be instanciated seperately...
|
by: Minh |
last post by:
I search in all the Disscussion but can not found.
How can I create a MS Access Database file using C# code with a given Table
Structure ?
For example, I want to create a Access Database File...
|
by: Terry Holland |
last post by:
I have just created my first asp.net application and I am ready to deploy.
The solution consists of the following:
A single asp.net assembly to be deployed to web server
A number of vb.net...
|
by: mehdi |
last post by:
Hi folks,
You know, the Thread class has got a method named Abort which
according to the msdn:
"Raises a ThreadAbortException in the thread on which it is invoked,
to begin the process of...
|
by: Coaster |
last post by:
I want to create a "thread manager" class to manage an array of
backgroundworkers. I'd like this thread manager class to live in a class
library and I wasn't sure if it was possible to make the...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |