Problem in assigning Time value to DataRow

  • 12 years ago

     

    Hey,

            i am really greatful to you for helping me, and now i want another help,

    this is my code:

     

    Column = new DataColumn();

    Column.DataType = System.Type.GetType("System.String");/* i think Here must be something else for Time */

    Column.ColumnName = "Proc_STime";

    Column.AutoIncrement = false;

    Column.ReadOnly = false;

    Column.Unique = false;

    Table.Columns.Add(Column);

    Column = new DataColumn();

    Column.DataType = System.Type.GetType("System.String");/* i think Here must be something else for Time */

    Column.ColumnName = "Proc_PProcTime";

    Column.AutoIncrement = false;

    Column.ReadOnly = false;

    Column.Unique = false;

    Table.Columns.Add(Column);

    Column = new DataColumn();

    Column.DataType = System.Type.GetType("System.String");/* i think Here must be something else for Time */

    Column.ColumnName = "Proc_UProcTime";

    Column.AutoIncrement = false;

    Column.ReadOnly = false;

    Column.Unique = false;

    Table.Columns.Add(Column);

     

    Process proc = Process.GetProcessById(m_nProcIDs[i]); /* where m_nProcIDs[i] is int array which contains process ids */

    Row = Table.NewRow();

    Row["Proc_ID"] = m_nProcIDs[i];

    Row["Proc_Name"] = m_strProcessNames[i];

    Row["Proc_Prio"] = proc.BasePriority;

    /*following three lines are creating some problem i dont know what it is coz it is also not giving error over there, but as soon as i take them out of comment, i get window showing " send this prob to microsoft or not" (usually we get in Win XP) */

     Row["Proc_STime"] = (proc.StartTime.GetDateTimeFormats('F', DateTimeFormatInfo.InvariantInfo))[0];

    Row["Proc_PProcTime"] = proc.PrivilegedProcessorTime.ToString();

     Row["Proc_UProcTime"] = proc.UserProcessorTime.ToString();

    /* Following lines are working properly */

    Row["Proc_VMem"] = proc.VirtualMemorySize64.ToString();

    Row["Proc_PMem"] = proc.PrivateMemorySize64.ToString();

    Row["Proc_PagedMem"] = proc.PagedMemorySize64.ToString();

    Row["Proc_PagedSysMem"] = proc.PagedSystemMemorySize64.ToString();

    Row["Proc_NPagedSysMem"] = proc.NonpagedSystemMemorySize64.ToString();

    Table.Rows.Add(Row);

    myDataSet = new DataSet();

    myDataSet.Tables.Add(Table);

    myDataSet.WriteXml("Proc_Details.xml");

     

     Please Help me out.


  • 12 years ago

    sorry my dear friend but this is not working, i have tried, it is giving the same exception.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Never trust a programmer in a suit.” - Anonymous