Help in my VB Code .. to Delete

This is a multi-part message in MIME format.

------=_NextPart_000_0089_01C34629.B378D5B0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi,=20

I have been trying to solve this problem since morning, and haven't =
really come up with a solution. it is frustrating. please help.
=20
i have a datagrid and got a delete column
=20
<asp:datagrid id=3D"dgdocument" runat=3D"server" =
AutoGenerateColumns=3D"False" EnableViewState=3D"True" =
OnDeleteCommand=3D"DeleteCommand">
<Columns>
 <asp:ButtonColumn Text=3D"Delete" =
CommandName=3D"Delete"></asp:ButtonColumn>
 <asp:BoundColumn DataField=3D"Param1" =
HeaderText=3D"Param1"></asp:BoundColumn>
 <asp:BoundColumn DataField=3D"Param2" =
HeaderText=3D"Param2"></asp:BoundColumn>
 <asp:BoundColumn DataField=3D"Param3" =
HeaderText=3D"Param3"></asp:BoundColumn>
</Columns>
</asp:datagrid>
=20
=20
and the VB code is=20

Sub DeleteCommand(ByVal Sender As Object, ByVal E As =
DataGridCommandEventArgs)
 Dim deletekey =3D dgdocument.DataKeys(CInt(E.Item.ItemIndex))
 Response.Write(deletekey)

 'load the XML
 Dim doc As New XmlDocument()
 doc.Load("c:\Inetpub\wwwroot\Cashier\cashier.xml")
 Dim onode As XmlElement =3D =
doc.SelectSingleNode("cashier/tag[@section=3D'workinformation-" & =
lbunique.Text & "' and @param1=3D'& deletekey & ' ]")
=20
 'not to sure whether this is right
 Dim oldNode As XmlNode =3D =
doc.RemoveChild("cashier/tag[@section=3D'workinformation-" & =
lbunique.Text & "' and @param1=3D'& deletekey & ' ]")

 ' ---------------- this is not right : deleting the node
 onode.RemoveChild(oldNode)

 ' save the xml=20
 doc.Save("c:\Inetpub\wwwroot\Cashier\cashier.xml")

 dgdocument.EditItemIndex =3D -1
 viewxmldtn()
End Sub
=20
and the XML file is=20

<cashier>
  <tag section=3D"work-14" param1=3D"1" param2=3D"345" =
param3=3D"7/9/2003 08:00 AM"  />
  <tag section=3D"work-14" param1=3D"2" param2=3D"345" =
param3=3D"7/9/2003 08:00 AM"  />
  <tag section=3D"work-14" param1=3D"3" param2=3D"345" =
param3=3D"7/9/2003 08:00 AM"  />
</cashier>
Param1 is a unique field.


What should the right syntax be to remove the node from the XML file.

Any help is appreciated.=20

Thank You


--=20
Thank You,
Sean
------=_NextPart_000_0089_01C34629.B378D5B0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hi,&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have been trying to solve this =
problem since=20
morning, and haven't really come up with a solution. it is frustrating. =
please=20
help.<BR>&nbsp;<BR>i have a datagrid and got a delete=20
column<BR>&nbsp;<BR>&lt;asp:datagrid id=3D"dgdocument" runat=3D"server"=20
AutoGenerateColumns=3D"False" EnableViewState=3D"True"=20
OnDeleteCommand=3D"DeleteCommand"&gt;<BR>&lt;Columns&gt;<BR>&nbsp;&lt;asp=
:ButtonColumn=20
Text=3D"Delete"=20
CommandName=3D"Delete"&gt;&lt;/asp:ButtonColumn&gt;<BR>&nbsp;&lt;asp:Boun=
dColumn=20
DataField=3D"Param1"=20
HeaderText=3D"Param1"&gt;&lt;/asp:BoundColumn&gt;<BR>&nbsp;&lt;asp:BoundC=
olumn=20
DataField=3D"Param2"=20
HeaderText=3D"Param2"&gt;&lt;/asp:BoundColumn&gt;<BR>&nbsp;&lt;asp:BoundC=
olumn=20
DataField=3D"Param3"=20
HeaderText=3D"Param3"&gt;&lt;/asp:BoundColumn&gt;<BR>&lt;/Columns&gt;<BR>=
&lt;/asp:datagrid&gt;<BR>&nbsp;<BR>&nbsp;<BR>and=20
the VB code is </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Sub DeleteCommand(ByVal Sender As =
Object, ByVal E=20
As DataGridCommandEventArgs)<BR>&nbsp;Dim deletekey =3D=20
dgdocument.DataKeys(CInt(E.Item.ItemIndex))<BR>&nbsp;Response.Write(delet=
ekey)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;'load the XML<BR>&nbsp;Dim doc As =
New=20
XmlDocument()<BR>&nbsp;doc.Load("c:\Inetpub\wwwroot\Cashier\cashier.xml")=
<BR>&nbsp;Dim=20
onode As XmlElement =3D=20
doc.SelectSingleNode("cashier/tag[@section=3D'workinformation-" &amp;=20
lbunique.Text &amp; "' and @param1=3D'&amp; deletekey &amp; '=20
]")<BR>&nbsp;<BR>&nbsp;'not to sure whether this is right<BR>&nbsp;Dim =
oldNode=20
As XmlNode =3D =
doc.RemoveChild("cashier/tag[@section=3D'workinformation-" &amp;=20
lbunique.Text &amp; "' and @param1=3D'&amp; deletekey &amp; ' =
]")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;' ---------------- this is not =
right :=20
deleting the node<BR>&nbsp;onode.RemoveChild(oldNode)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;' save the xml=20
<BR>&nbsp;doc.Save("c:\Inetpub\wwwroot\Cashier\cashier.xml")</FONT></DIV>=

<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;dgdocument.EditItemIndex =3D=20
-1<BR>&nbsp;viewxmldtn()<BR>End Sub<BR>&nbsp;<BR>and the XML file is=20
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;cashier&gt;<BR>&nbsp; &lt;tag =
section=3D"work-14"=20
param1=3D"1" param2=3D"345" param3=3D"7/9/2003 08:00 AM"&nbsp; =
/&gt;<BR>&nbsp; &lt;tag=20
section=3D"work-14" param1=3D"2" param2=3D"345" param3=3D"7/9/2003 08:00 =
AM"&nbsp;=20
/&gt;<BR>&nbsp; &lt;tag section=3D"work-14" param1=3D"3" param2=3D"345"=20
param3=3D"7/9/2003 08:00 AM"&nbsp; /&gt;<BR>&lt;/cashier&gt;<BR>Param1 =
is a unique=20
field.</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=3DArial size=3D2>
<DIV><BR>What should the right syntax be to remove the node from the XML =

file.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Any help is appreciated. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank You</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- <BR>Thank=20
You,<BR>Sean</FONT></DIV></BODY></HTML>

------=_NextPart_000_0089_01C34629.B378D5B0--

0
Sean
7/9/2003 8:52:21 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
422 Views

Similar Articles

[PageSpeed] 0

Please don't cross-post (posting to more than 1 newsgroup at a time).

I think what you want is to find the node.
 Dim oldNode As XmlNode =
doc.SelectSingleNode("cashier/tag[@section='workinformation-" &
lbunique.Text & "' and @param1='& deletekey & ' ]")
 onode.RemoveChild(oldNode)


-- 
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans


"Sean" <nospam@> wrote in message
news:eJGehvlRDHA.1572@TK2MSFTNGP12.phx.gbl...
hi,

I have been trying to solve this problem since morning, and haven't really
come up with a solution. it is frustrating. please help.

i have a datagrid and got a delete column

<asp:datagrid id="dgdocument" runat="server" AutoGenerateColumns="False"
EnableViewState="True" OnDeleteCommand="DeleteCommand">
<Columns>
 <asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
 <asp:BoundColumn DataField="Param1" HeaderText="Param1"></asp:BoundColumn>
 <asp:BoundColumn DataField="Param2" HeaderText="Param2"></asp:BoundColumn>
 <asp:BoundColumn DataField="Param3" HeaderText="Param3"></asp:BoundColumn>
</Columns>
</asp:datagrid>


and the VB code is

Sub DeleteCommand(ByVal Sender As Object, ByVal E As
DataGridCommandEventArgs)
 Dim deletekey = dgdocument.DataKeys(CInt(E.Item.ItemIndex))
 Response.Write(deletekey)

 'load the XML
 Dim doc As New XmlDocument()
 doc.Load("c:\Inetpub\wwwroot\Cashier\cashier.xml")
 Dim onode As XmlElement =
doc.SelectSingleNode("cashier/tag[@section='workinformation-" &
lbunique.Text & "' and @param1='& deletekey & ' ]")

 'not to sure whether this is right
 Dim oldNode As XmlNode =
doc.RemoveChild("cashier/tag[@section='workinformation-" & lbunique.Text &
"' and @param1='& deletekey & ' ]")

 ' ---------------- this is not right : deleting the node
 onode.RemoveChild(oldNode)

 ' save the xml
 doc.Save("c:\Inetpub\wwwroot\Cashier\cashier.xml")

 dgdocument.EditItemIndex = -1
 viewxmldtn()
End Sub

and the XML file is

<cashier>
  <tag section="work-14" param1="1" param2="345" param3="7/9/2003 08:00 AM"
/>
  <tag section="work-14" param1="2" param2="345" param3="7/9/2003 08:00 AM"
/>
  <tag section="work-14" param1="3" param2="345" param3="7/9/2003 08:00 AM"
/>
</cashier>
Param1 is a unique field.


What should the right syntax be to remove the node from the XML file.

Any help is appreciated.

Thank You


-- 
Thank You,
Sean


0
kaevans (29)
7/10/2003 6:05:27 PM
Reply:

Similar Artilces:

help with log file
Got a database in SQL2005 that is basically a download of a daily flat text files and creating tables from them. The log.ldf file is frikkin huge. It's over 146GB and I don't need this, I have storage issues. How do I shorten down this file and keep it small forever? Hi Rocketman Have you read about managing the transaction log in the Books Online? How big is your database? What recovery model are you in? What kinds of backups are you doing, and how frequently? If you are not in SIMPLE recovery, and you don't back up your log, it will continue to grow. Even...

using if function..please help
i am trying to use the if function in the following manner. A B apple red apple red grapes purple grapes yellow star n/a if(B1:B5="n/a",0,countif(A1:A5, "star") I want to use this formula not only for 'star' but also for 'apple' and grapes' and many more such fruits which might have n/a later. But, everytime I use this formula it returns a 1..should it not return a 0 for when the value in B is n/a? Please help.. Thank you Are you trying to say that if any c...

Need help in accessing a sharepoint site that I created with the AllTemplates.exe
SBS2008 with WSS 3.0 I downloaded the AllTemplates.exe from Microsoft and installed the Helpdesk template. I can acess the Helpdesk site from SBS2008 and add things to it but I can't access it from a workstation. Can anyone help me out? Thanks You mean you can only access the site from the Server in local , right? maybe we need more information such as error message. how about doing "ping" or "tracert" result. can you access a normal web site (not sharepoint site) from the workstation ? do you get an authentication window ? "john doe" wr...

Outlook delegate-mailbox deletion problem
This sounds like an easy one however, haven't found resolution yet. Here's scenario... User B reported to User A and added A to his delegation for being copied on all meeting request replies (done from Outlook 2000). All was well until User A left the company and mailbox was subsequently archived and deleted. Ever since the mailbox deletion, all attendees accepting a meeting request from User B receive an NDR referencing inability to deliver reply to User A's mailbox. The typical answer would be to open User B's Outlook app, goto delegates and remove User A.. The problem is...

Disabling F1 key's Windows Help Function
We'll I guess the title says it all :) Just curious if there is an easy way to disable F1 from always trying to bring up Window's help whenever it is hit within the program. I find it more than a little annoying because even in my program where (I thought) I was capturing all keystrokes for a keyDown event (I added UINT MyClass:OnGetDlgCode() { return DLGC_WANTARROWS|DLGC_WANTALLKEYS|DLGC_WANTCHARS; } Hmmm, so can I add something else to this line perhaps (going to check on this now) in order to catch ALL keystrokes (or at least add something so windows help function will be di...

How to convert a Chinese registry value from within a US code page?
First of all, our Win32 MFC VC++ app is not written in Unicode as it should have been. Given that - it reads uninstall information from the windows Uninstall registry tree and writes it to a report. It writes out the displayname of the application. Normally this is not a problem, but when it encounters a Chinese application name, it displays the name as question marks. I assume this is because the string is in Unicode in the registry, but our app is not Unicode so it can't represent the characters. Unfortunately for the moment, converting this very large app to Unicode is not an o...

Deleted Accounts in AD
Hello! I am trying to reduce store database sizes by emptying mailboxes of accounts deleted in Active Directory. I tried creating a profile in Outlook but cannot resolve the account name. Is there a way to do this without recreating the account and reconnecting to the mailbox? I would reduce the store sizes by approx. 2 GB. Thank you. -- JoeCL LACO-CAO if you have no need for the data in the mailboxes, just purge them... -- Susan Conkey [MVP] "JoeCL" <JoeCL@discussions.microsoft.com> wrote in message news:1BA4EE14-82E1-42E7-96F3-F79BA50B5793@microsoft.com... >...

Select Case help needed
I'm using a Select Case statement to check the value of 24 checkboxes on a form. If true for each case, run the related query. It seems to be running the first query it comes to and not continuing to check the rest. Below is sample code for the first 4 checkboxes. Can anyone help? Select Case True Case Me.chkQCT01.value = True DoCmd.OpenQuery "AccessMWapp", acNormal, acEdit Case Me.chkQCT02.value = True DoCmd.OpenQuery "AccessSEapp", acNormal, acEdit Case Me.chkQCT03.value = True DoCmd.OpenQuery "AccessSWapp", acNormal...

Quick Campaign "In Progress" HELP
I have a Quick Campaign that shows as "In Progress" for over a week now so it must be hung. How do I restart or get it going again? It sends out approx. 3000 emails each time. It got approx 2000 emails out and is now hung. I hace rebooted the CRM server itself but this had no impact. I'm afraid that if I do another Quick Campaign before resolving this it will just hang also. This has been working great for months until now. HELP! -- Dennis ...

2003 code raises error in 2007
I have a reference in VBA to a subform of a subform, which works fine in Access 2003. In Access 2007, however, it results in "you have entered an invalid reference to the property Form/Report." This is the snippet of code: Private Sub SetFormProperties() 'called from form_open, makes all forms editable if edit mode was selected Dim ctrl As Control, ctrlSub As Control Dim frm As Form If Me.OpenArgs = "Edit" Then Set frm = Me 'set main form edit options EditProperties frm 'set subform edit options For Each ctrl In frm If ct...

Help with VBasic in Excel 2003
I'm using Excel 2003. I am working in a master worksheet named "SHPG RCVG RPT" which is on my desktop. After I enter all of the information and create my hyperlinks, I need to protect the worksheet and then save it to a different folder. The new name of the worksheet is determined by the purchase order # which is in cell D3. I need a macro which will: Protect the worksheet --> Name the worksheet using the purchase order # in D3 -->Save the worksheet in: F:\SHIPPING RECEIVING REPORT. I can't do this using the macro recorder because it won't let me click on the ...

Labels not printing zip codes
I am doing a simple mail merge from other peoples excel lists...when I print the lables, many of the zip codes show as a zero on the label. I notice a green comment error corner and by ignoring the error, the problem goes away but what causes this to begin with? If I highlight the whole column to format as zip codes the boxes do not go away. If I correct and then copy the data to a new sheet the new formatting does not save. Debra Dalgleish posted this to a similar question: There's an article on the Microsoft web site that might help you: Answer Box: Numbers don't merge rig...

Need help with Access report
I designed an access report with a facility and a buch of contacts for that. I created a group on the facility ID. I want only a certain type of contact to show up in the facility group header and rest of the contact types in the details sectio. Before some takes a wag at answering this, could you provide a little better description? Individual contacts normally would display in the detail section, not "in the facility group header". Maybe you should type in some significant records/fields and how and why they should display in your report. -- Duane Hookom Microsoft Access M...

Forms Help
I have a form, the form has an ID that goes through many test/parameters. All the test/parameters associated with the ID remains on a sub form for viewing. I would like to develop a series (a-z) for each ID,were repeating information for the id is carried throughout all ID's and the one test paramter that differed, thus changing the Series Letter will be changed. Do you have any suggestions. Thanks LA -- Message posted via http://www.accessmonster.com On Wed, 22 Aug 2007 14:04:05 GMT, "misschanda via AccessMonster.com" <u36612@uwe> wrote: >I have a form, the for...

Emails moved from Sent Items to subfolder moving to Deleted Items instead
We have a problem where a couple of users are moving emails from their Sent Items to folders that are subfolders of their Inbox. However, random emails are moving to the Deleted Items instead. The users have no rules set up, and there is no limit on mailbox size for users. I know it's easy to dismiss them as having made a mistake, but one of the users is pretty competent and has in fact had this problem in the past. Has anyone experienced this problem? ...

CRM Bulk Delete of Activities
We are new to CRM, and in the "testing" phase of implementation. Our marketing group has used smart lists and quick campaign which results in 30,000 open activies (emails). We can respond/delete/acknowledge them 250 at a time via the activities view. Clearly waiting for screen refreshes 120 times would waste a lot of time. Is there a way to "respond" to activies at a campaign level or in bulk? This is a multi-part message in MIME format. ------=_NextPart_000_0108_01C83679.362A3E60 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quot...

vlookup problem please help
Hi experts, I have a problem in using vlookup function and have not been able to resolve for a year+. Hope I can find some help in this great forum. Many thanks in advance! An example as below. When I vlookup Material2 to Material1 for the Project No, I get the result 222-56 for all the duplicate Material1 values. In this case of having duplicate values in Material1 but associated with different Project Numbers, how can I have vlookup function to match the Project No. containg "AA" as 1st priority ? (and if there is no Project No. containing "AA", then vlookup to look f...

Help Please #8
Thanks For The Info : -- mikeee ----------------------------------------------------------------------- mikeeee's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1461 View this thread: http://www.excelforum.com/showthread.php?threadid=26424 ...

Help with Expressions
We inventory wood poles in 19' lengths which we then cut into smaller pieces for our customers. Is there an expression I can use to help me reduce waste when we are cutting the poles? At one time, we may be cutting 10 to 30 peices in differing lengths ranging from 18" to 160" or larger. On Sun, 22 Nov 2009 05:42:01 -0800, LeLe <LeLe@discussions.microsoft.com> wrote: >We inventory wood poles in 19' lengths which we then cut into smaller pieces >for our customers. Is there an expression I can use to help me reduce waste >when we are cutting the p...

Function Help Please
Tuesday, April 14, 2009 That data above, once imported from a tab delimited file, is interpreted by Excel as General format. This is a couple of years worth of this data. I'd like to shorten the date while removing the day from the beginning. Highlighting the cell then manually changing the format to Date does nothing. I think my only option is to use a function that keeps all data after the first space. Thanks, AJ Select the column with those "dates" in it, then click Edit/Replace on Excel's menu bar... type these four characters (without ...

An Object could not be found??!? Please Help!
I have seen this question asked a few times on Web Forums as well as newsgroups, however it seems that none of the solutions seem to work for me. Here is my scenario. I recently purchased a brand new Dell Server and workstations. The Dell Server is configured as a PDC running Windows Server 2003. The workstations are running Windows XP with Office 2003 installed. The only other software installed on both server and workstations are Symantec Corporate Edition Virus v.7.6, and Exchange Server 2003 on the server. I ran the Exchange Server setup and all seemed to go well. I created a mailbo...

can't open VB editor in Excel 2007 under Vista
I have a spreadsheet with VB code in it. On my XP PC I can edit it without any problem. On my Vista PC, I can run the code, but if I try to edit it I get "error in loading dll". The VB window opens up, but the modules won't. Also, it used to work - I don't know why it stopped. Can anyone help? Thanks! On Nov 11, 3:42=A0am, "Sandy Rosenberg" <srosenb...@bloomfieldct.deleteme.org> wrote: > I have a spreadsheet with VB code in it. =A0On my XP PC I can edit it wit= hout > any problem. =A0On my Vista PC, I can run the code, but if I try to edit = it...

selectively deleting cells
I would like to selectively delete alternate rows on an excel worksheet containing a long list of data. i.e. deleting rows/cells A3,A5,A7,A9,A11....A30573 etc. How do i do this quickly without having to use CTRL + select for each specific cell/row? Del, It isn't clear what you mean by "selectively" delete the rows. If you just want to delete every other row, use code like Sub DeleteEveryOtherRow() Dim RowNdx As Long Application.ScreenUpdating = False For RowNdx = 30573 To 3 Step -2 Rows(RowNdx).Delete Next RowNdx Application.ScreenUpdating = True E...

help with type mismatch
I keep getting a type mismatch error with the following code. Dim lngLoad As Long, lngUnload As Long, lngBobtail As Long 'find mileage where last loaded lngLoad = _ "SELECT Top 1 qryCalculateStatusMiles.Odometer " & _ "FROM qryCalculateStatusMiles " & _ "WHERE (((qryCalculateStatusMiles.StopPurpose) = '" & "Load" & "'" & ")) " & _ " OR (((qryCalculateStatusMiles.StopPurpose)= '" & "Unload/Reload" & "'&...

Set report criteria in code?
Is it possible to set a reports criteria in code? I am trying to use Stephen Lebans report-to-pdf tool, which uses the report as a parameter. I need to specify a criteria for the report, like I do when I open the report for printing: DoCmd.OpenReport strReportName, acViewNormal, , strReportParam I don't see how to set report criteria in the report-to-pdf tool, but if I can set the criteria before I use the tool, that should work. Thanks in advance for any help. Fred I haven't used Stephens solution but you can always use a little DAO code to dynamically change...