Y
Yatharth
Hi,
I m new to threading and i have successfully runed threading but i
could display value on my web page ,but its working in code behind
when i see it through debugger,plzzzzzzz help me here is the code
below:
i just wana display the simple array value stored in my array variable
in my textbox thats it.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
//using MultithreadingApplication.Class ;
using System.Threading;
using System.Data.SqlClient;
namespace MultithreadingApplication
{
public class WebForm2 : System.Web.UI.Page
{
string strglobal="";
Object objCust=new Object() ;
int j=0;
protected System.Web.UI.WebControls.Label Label1;
private void Page_Load(object sender, System.EventArgs e)
{
ThreadStart simplest = new ThreadStart(Simplest);
Thread thread1 = new Thread( simplest ) ;
thread1.Start() ;
Label1.Text=strglobal;
}
public string GetCustomers()//string city)
{
string []str=new string[2] ;
string strsql="select firstname,lastname from employees";
SqlConnection conn =new SqlConnection();
DataSet CustDS =new DataSet();
conn.ConnectionString=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
SqlCommand commnd=new SqlCommand(strsql,conn);
SqlDataReader dr ;
conn.Open();
dr=commnd.ExecuteReader();
if(dr.Read())
{
for(int i=0;i<1;i++)
{
str[0]=dr["firstname"].ToString() ;
}
}
conn.Close();
TextBox1.Text =j.ToString() ;
j++;
return str[0];
}
public void Simplest()
{
TextBox1.Text=strglobal;
for(;
{
//string i="yy";
strglobal=GetCustomers();
Thread.Sleep(10000) ;
}
//Console.WriteLine( "Simplest worker - done" ) ;
}
}
}
Please email me if u anybody have the solution i will be very
thankful.
Email:[email protected]
I m new to threading and i have successfully runed threading but i
could display value on my web page ,but its working in code behind
when i see it through debugger,plzzzzzzz help me here is the code
below:
i just wana display the simple array value stored in my array variable
in my textbox thats it.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
//using MultithreadingApplication.Class ;
using System.Threading;
using System.Data.SqlClient;
namespace MultithreadingApplication
{
public class WebForm2 : System.Web.UI.Page
{
string strglobal="";
Object objCust=new Object() ;
int j=0;
protected System.Web.UI.WebControls.Label Label1;
private void Page_Load(object sender, System.EventArgs e)
{
ThreadStart simplest = new ThreadStart(Simplest);
Thread thread1 = new Thread( simplest ) ;
thread1.Start() ;
Label1.Text=strglobal;
}
public string GetCustomers()//string city)
{
string []str=new string[2] ;
string strsql="select firstname,lastname from employees";
SqlConnection conn =new SqlConnection();
DataSet CustDS =new DataSet();
conn.ConnectionString=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
SqlCommand commnd=new SqlCommand(strsql,conn);
SqlDataReader dr ;
conn.Open();
dr=commnd.ExecuteReader();
if(dr.Read())
{
for(int i=0;i<1;i++)
{
str[0]=dr["firstname"].ToString() ;
}
}
conn.Close();
TextBox1.Text =j.ToString() ;
j++;
return str[0];
}
public void Simplest()
{
TextBox1.Text=strglobal;
for(;

{
//string i="yy";
strglobal=GetCustomers();
Thread.Sleep(10000) ;
}
//Console.WriteLine( "Simplest worker - done" ) ;
}
}
}
Please email me if u anybody have the solution i will be very
thankful.
Email:[email protected]