hii all i have a winform in which m trying to update data from tally to server
database.any change in tally gets reflected to server.i am doing all this through threading.now i want to show the data in datagrid from server on clicking the menu.
Its working fine and shows data in datagrid but sometimes it does not show data in
grid.i cant figure out the problem.tell me where m i wrong....!!
if (thrd != null)
{
if (thrd.ThreadState == ThreadState.Stopped || thrd.ThreadState == ThreadState.WaitSleepJoin || thrd.ThreadState == ThreadState.Aborted)
{
thrd = new Thread(new ThreadStart(startprocess));
thrd.Start();
}
else
{
startprocess();
}
}
else
{
thrd = new Thread(new ThreadStart(startprocess));
thrd.Start();
}
in startproceess m comparing the data of tally and server n if any change is made to tally data it gets updated
through startprocess.this is background process.now at front end if i clcik on menu stock item.it shows data in grid.
but the data is sometimes available sometimes not.
string query = "select * from Product_Master where Compid=(select Companyid from Company_Master where Companyname='" + txtuserid.Text + "')";
SqlDataAdapter da = new SqlDataAdapter(query, conn);
DataTable dt = new DataTable();
da.Fill(dt);
gridproduct.DataSource = dt;
panel4.Visible = true;