473,750 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

strange datagrid problem

I'm having an odd problem with a datagrid in a c# program. The program
maintains a schedule of jobs that need to be run. As jobs run, the status
and next run date/time info are updated in a SQL database. On the initial
load, the datagrid fields are defined. The 1st time the dataset is reloaded,
an error is returned stating that the 1st field in the list is not found. On
all subsequent reloads, everything is fine. Here's the relevant code (I
chopped out as much as I thought I could and still illustrate the problem
areas). It seems like the problem is being caused by using the Process
object. If I comment out the portion of the routine that sets up and runs
the jobs, the grid always works. Any help solving this would be appreciated.

private void RunThisJob()
{
try
{
DataSet statusSet = midConn.GetData ("JobMaster" , "select * from
JobMaster where id = " + jobRow["id"].ToString());
statusSet.Write Xml(jobRow["xmlName"].ToString(),
XmlWriteMode.Wr iteSchema);
lastJobName = jobRow["jobTitle"].ToString();
theStatus.Text = DateTime.Now.To ShortDateString () + " " +
DateTime.Now.To ShortTimeString () +
" running " + lastJobName;
Process myProcess = new Process();
myProcess.Start Info.FileName = jobRow["programPat h"].ToString();
myProcess.Start Info.Arguments = jobRow["configName "].ToString() + " " +
jobRow["xmlName"].ToString();
myProcess.Start ();
myProcess.WaitF orExit();
resultSet = new DataSet();
resultSet.ReadX ml(jobRow["xmlName"].ToString(), XmlReadMode.Rea dSchema);
resultRow = resultSet.Table s[0].Rows[0];
DoStatus((bool) resultRow["lastStatus "],
resultRow["lastMessag e"].ToString());
}
catch(Exception ex)
{
SendConfirmatio n("Exception executing job " + lastJobName + ": " +
ex.Message, false);
theStatus.Text = "Exception executing job " + lastJobName + ": " +
ex.Message;
resultRow = null;
DoStatus(false, ex.Message);
}
finally
{
jobSet = midConn.GetData ("JobMaster" , "select * from JobMaster where id
= " + jobRow["id"].ToString());
jobRow = jobSet.Tables[0].Rows[0];
jobRow["lastRun"] = DateTime.Now;
ScheduleJob();
}
}

private void LoadSchedule(Da teTime nextDate)
{
try
{
jobRow["nextRun"] = nextDate;
jobRow["retryCount "] = 0;
DataSet rd = midConn.PutData (jobSet.GetChan ges());
jobSet = midConn.GetData ("JobMaster" , "select * from JobMaster order by
nextRun, jobTitle");
ShowJobs();
jobRow = null;
}
catch (Exception ex)
{
SendConfirmatio n("Exception writing next scheduled date for " +
lastJobName + ": " + ex.Message, false);
}
}

private void ShowJobs()
{
try
{
if (jobGrid.TableS tyles.Count == 0)
{
jobStyle = new DataGridTableSt yle();
jobStyle.Mappin gName = "JobMaster" ;
jobGrid.TableSt yles.Add(jobSty le);
DataColumn jobID = (DataColumn)job Set.Tables[0].Columns["id"];
jobSet.Tables[0].PrimaryKey = new DataColumn[1]{jobID};
jobGrid.SetData Binding(jobSet, jobSet.Tables[0].TableName);
jobStyle.GridCo lumnStyles.Clea r();
DataGridTextBox Column cs = new DataGridTextBox Column();
cs.MappingName = "jobTitle";
cs.HeaderText = "Job Name";
cs.Alignment = HorizontalAlign ment.Left;
cs.Width = 350;
jobStyle.GridCo lumnStyles.Add( cs);
DataGridTextBox Column cs2 = new DataGridTextBox Column();
cs2.MappingName = "lastRun";
cs2.HeaderText = "Last Run";
cs2.Alignment = HorizontalAlign ment.Left;
cs2.Width = 125;
cs2.Format = "MM/dd/yy hh:mm tt";
jobStyle.GridCo lumnStyles.Add( cs2);
DataGridTextBox Column cs3 = new DataGridTextBox Column();
cs3.MappingName = "nextRun";
cs3.HeaderText = "Next Run";
cs3.Alignment = HorizontalAlign ment.Left;
cs3.Width = 125;
cs3.Format = "MM/dd/yy hh:mm tt";
jobStyle.GridCo lumnStyles.Add( cs3);
DataGridBoolCol umn bs = new DataGridBoolCol umn();
bs.MappingName = "active";
bs.HeaderText = "Active";
bs.Alignment = HorizontalAlign ment.Left;
bs.Width = 50;
jobStyle.GridCo lumnStyles.Add( bs);
}
else
jobGrid.SetData Binding(jobSet, jobSet.Tables[0].TableName);
}
catch (Exception ex)
{
theStatus.Text = "Error in ShowJobs - " + ex.Message;
}
}

Nov 17 '05 #1
0 1274

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2289
by: Zeppo | last post by:
Hello, who can help me out on a strange problem? Ik created a small app with vb6p (on w2kp). It worked fine, and i copied the generated .exe (68k) on my laptop (XPH) It complained about some missing ocx'es, so i downloaded them from the internet and registered them with regsvr32 \WINDOWS\system32\TABCTL32.OCX
0
1523
by: elime | last post by:
Hi all I have a strange behaving on some PC with my DataGrid. It only occurs on some PC, on others it works perfectly fine. ->(same ..net version installed) it's very confusing. starting position: I click with the mouse into a cell of the DataGrid, the cell gets active (gray) and marks the cell-content.
5
1154
by: EMW | last post by:
On my pc on which I created my aspx files, my site works fine. I use IIS5 and is does everything I want it to do. I moved my site to the networkserver (it's a intranet site) and then something strange happens. On my photo page, I show a few pictures that are found in a certain folder. But instead of seeing my pictures, I see only the placeholders with a little icon in the left-upper corner with a red cross in it. I know it finds the...
1
1355
by: Kepler | last post by:
I'm fighting a really strange bug that involves both a DataGrid and a Repeater disappearing on postback. The strange thing is that I've distilled the problem down to a simple program, that originally could reproduce the problem, but now can't, even as I add complexity back in. The basic scenario is a custom DataGrid (just make a class that derives from DataGrid) that has a LinkButton in a HeaderTemplate that has a CommandName="sort"...
2
3449
by: Tim_Mac | last post by:
hi, i have an aspx page which dynamically loads a user control and adds it to a placeholder. the control is recreated and added to the placeholder for postbacks as well. the user control contains a datagrid and some buttons and textboxes. the button events fire correctly and execute their code. however, the datagrid events fire a postback, and execute Page_load in the usercontrol, but the Item_Command code is not executed. the code to...
2
1085
by: sosh | last post by:
Hi, I'm having a strange problem with the update function of a datagrid: I have a datagrid, the first column lists item names from a database. Second column is an EditCommandColumn, and then I have a couple of button columns after that to deal with row deletes etc. The problem is occuring in the method that I have specified should deal with the update event:
0
902
by: Wim Geukens | last post by:
Hi, We're experiencing a very strange session variable problem. We've got a running version of our site at www.mysite.com, which points to c:\mysite in IIS 5 This same site is also reachable via test.mysite.com, because we specified it in the "Advanced multiple Web Site configuration" dialog box. So it's basically the same website. Now, on our site we have a datagrid with paging enabled.
8
6714
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and contains a few controls anchored to the sides of the form. "frmChild" inherits from "frmBase"... and the controls appear on the inherited form as expected. However things start going wrong when I place addition controls on the "frmChild" form. When I...
3
1248
by: simchajoy2000 | last post by:
Hi, I am using a datagrid which contains a dataset with several tables and I am experiencing an inexplicable behavior that I am unable to resolve. Perhaps it's due to the complexity of my scenario which I will briefly describe here just in case it is a factor: I am querying an Access database and displaying the results in a Datagrid - then the user can perform additional queries based on the displayed Access information and I then...
0
9001
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9398
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9345
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9257
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8265
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4894
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2227
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.