That's exactly what I need. Thank You So Very Much! :)
SJR_1
Posts
-
Read XML values (attributes and elements) with C# -
Read XML values (attributes and elements) with C#I will be writing the records to a database. I thought the best way of doing that was getting the data into a datatable. to do that I need to add rows and populate the columns with the individual elements or attributes. The element Item and ItemNumber are only present in some conditions. So when I add them to the variables I should see something like this: +If all items exist Time = (string)c.Element("Time"), Description = (string)c.Element("Description"), ItemId = (int)c.Attribute("Itemid"), ***Note not HomeItemId**** Name = (string)c.Element("Name"), //Coffee ItemDescrip = (string)c.Element("ItemDescrip"), +If NO items exist Time = (string)c.Element("Time"), Description = (string)c.Element("Description"), ItemId = "" Name = "" ItemDescrip = "" Thanks, Sue
-
Read XML values (attributes and elements) with C#Thank You, I have one more step to go. I'm getting the values into the variables, the only issue is getting the values that are in the item element.
<Item>
<ItemNumber id="0">
<Name>Coffee</Name>
<ItemDescrip>I Descrip1</ItemDescrip>
</ItemNumber>
<ItemNumber id="1">
<Name>Tea</Name>
<ItemDescrip>I Descrip 2</ItemDescrip>
</ItemNumber>
</Item>The tricky part to me is that sometimes they exists and other times they don't.
-
Read XML values (attributes and elements) with C#XML File
<Log>
<HomeItem id="2">
<Time>1/8/2014 3:21:47 PM</Time>
<HasNewAddress>Y</HasNewAddress>
<AddressType>N</AddressType>
<Description>myDescrip</Description>
<Item/>
<Title/>
</HomeItem>
<HomeItem id="3">
<Time>1/8/2014 6:52:47 PM</Time>
<HasNewAddress>Y</HasNewAddress>
<AddressType>N</AddressType>
<Description>myDescrip2</Description>
<Item>
<ItemNumber id="0">
<Name>Coffee</Name>
<ItemDescrip>I Descrip1</ItemDescrip>
</ItemNumber>
<ItemNumber id="1">
<Name>Tea</Name>
<ItemDescrip>I Descrip 2</ItemDescrip>
</ItemNumber>
<ItemNumber id="2">
<Name>Milk</Name>
<ItemDescrip>I Descrip 3</ItemDescrip>
</ItemNumber>
</Item>
<Title/>
</HomeItem>
<HomeItem id="4">
<Time>1/8/2014 7:35:47 PM</Time>
<HasNewAddress>Y</HasNewAddress>
<AddressType>N</AddressType>
<Description>my Descrip 3</Description>
<Item>
<ItemNumber id="7">
<Name>Juice</Name>
<ItemDescrip>I Descrip 4</ItemDescrip>
</ItemNumber>
<ItemNumber id="8">
<Name>Tea</Name>
<ItemDescrip>I Descrip 6</ItemDescrip>
</ItemNumber>
<ItemNumber id="9">
<Name>Milk</Name>
<ItemDescrip>I Descrip 7</ItemDescrip>
</ItemNumber>
</Item>
<Title>The Title</Title>
</HomeItem>
<HomeItem id="5">
<Time>1/8/2014 12:21:47 PM</Time>
<HasNewAddress>Y</HasNewAddress>
<AddressType>N</AddressType>
<Description>myDescrip 8</Description>
<Item/>
< -
SHDocVw.ShellWindows .Quit does not stop processI have an application that closes all IE windows that have "MKR" string in the address when the application closes. The problem is that explorer.exe is still listed in the processes. How do I get rid of the process when I close the application? SR
-
FormView get control valueIn my code below I'm trying to have the user click on an image. Then pass that associated ID of that image (through XML it is associated). Any help is welcomed: <%@Page Language="VB" Debug="True" %> Protected Sub Formview1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewPageEventArgs) MsgBox(sender.ToString) End Sub Sub Get_Shape(ByVal Src As Object, ByVal Args As ImageMapEventArgs) Response.Write("<b>'" & Args.PostBackValue & "'</b> was clicked") Response.Write((Me.Formview1.FindControl("lblID").ToString() & " Label Value")) End Sub
ID:
XML file -
Get label ValueIn my code below I'm trying to have the user click on an image. Then pass that associated ID of that image (through XML it is associated). Any help is welcomed: <%@Page Language="VB" Debug="True" %> Protected Sub Formview1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewPageEventArgs) MsgBox(sender.ToString) End Sub Sub Get_Shape(ByVal Src As Object, ByVal Args As ImageMapEventArgs) Response.Write("<b>'" & Args.PostBackValue & "'</b> was clicked") Response.Write((Me.Formview1.FindControl("lblID").ToString() & " Label Value")) End Sub
ID:
XML file Thanks -
Reporting ServicesI've created a report with 3 drill down groups in a table control. Issue is when the parent group is not expanded the report has a gap (white space) between the first parent item in the group and the next parent item. -Stores +Joe's Grocery(10) +Mark's Grocery(1) +etc.... Any ideas how to control the row height by what is being displayed? Sue
-
Datatable Adding RowI'm returning a datatable from the DB, I need to add a row to that datatable for display only. That piece is working fine, the issue is I need that record to be the first record displayed in the cbo box. System.Data.DataRow dr = WorkTable.NewRow(); WorkTable.Rows.Add(new object[] {"ALL", "AL","","","","","","",-2,1,"UNKNOWN"}); cbo.DataSource = WorkTable; --I need to have the added line first in the combo box. Thanks
-
FileAttributesCan you take it one step further? I used this code to try to change the attribute: File.SetAttribute(path, FileAttributes. ); I could only find .ReadOnly and that's not what I want.
-
FileAttributesI copy a "ReadOnly" file. I change it's name and then go to delete it. Problem it won't delete because it is ReadOnly (At least when I remove ReadOnly it deletes fine). This is the error I receive: ERROR in test System.UnauthorizedAccessException: Access to the path "c:\test\\test.dll" is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.File.Delete(String path) at Check.RunTest.DoRun(String path) in c:\project\runtest.cs:line 38 Here is my code: try { string[] testfiles = Directory.GetFiles(path); foreach( string testfile in testfiles) { string testFolderName = path + @"\" + Path.GetFileName(testfile); //Copy for short name - Name file T + extension File.Copy(testFolderName, path + @"\T" + Path.GetExtension(testfile)); File.Delete(testFolderName); RunProg(testFolderName,Path.GetExtension(testfile),Path.GetFileNameWithoutExtension(testfile) ); } } catch(Exception e) { Console.WriteLine("ERROR in RUNGliChk " + e.ToString()); } Thanks
-
Command LineI'm trying to send commands from my C# project to the command line. The cmd is opening but the arguments are not being passed. Here is my code: System.Diagnostics.ProcessStartInfo psi = null; System.Diagnostics.Process proc = null; psi = new System.Diagnostics.ProcessStartInfo("cmd"); proc = new System.Diagnostics.Process(); proc.StartInfo = psi; System.Diagnostics.Process.Start(psi); psi.Arguments = @"ping dev12"; Application.DoEvents(); System.Diagnostics.Process.Start(psi); proc.WaitForExit(); Thanks.