Re: another delete prob.
From: Marc Miller (mm1284_at_hotmail.com)
Date: 02/22/05
- Next message: Bernie Yaeger: "submitting updates when there's no primary key"
- Previous message: Marina: "Re: Where clause in DataTable.Select method"
- In reply to: Cowboy (Gregory A. Beamer) - MVP: "RE: another delete prob."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 22 Feb 2005 11:21:38 -0500
Cowboy,
Thanks for your response. Yes (chagrin), it is a drag & drop. I'm sorry
that I
didn't show the connection for the dataadapter in the code.
What I was doing was preserving a dataset that was displayed in the form
from the Page_Load
event. If the user decides to delete the record, I then reload the dataset
from the
XML file.
What was missing from my code was adding a 'DsBldgData1.AcceptChanges()'
directly after the reload of the dataset and before the record.delete(). I
found
this by experimentation.
Thanks again,
Marc Miller
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@comcast.netNoSpamM> wrote
in message news:BE0F5FA9-823E-4FEC-B66F-DB906399C82E@microsoft.com...
> I am not sure what you are trying to do here. From your statement, I
assume
> you are attempting to update a database table, but I do not see where the
> adapter actually gets connected to the database. With the naming, I assume
> this was a drag and drop setup?
>
> You are then reading in records from an XML file, deleting them and
calling
> Update(). As these are not records from the database itself, they will, at
> best, be seen as added records that were deleted, essentially nulling out
any
> changes. If I am misunderstanding the code, please clue me in.
>
> If your goal is to update the XML, delete the nodes and WriteXml() back to
> the file. If you are updating a database, you need to reference rows
there;
> if this is not possible, you will have to write custom code to delete
records.
>
> Hope this helps.
>
>
> ---
>
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
>
> "Marc Miller" wrote:
>
> > I've read other posts concerning unsuccessful deletes, but I can't find
> > anything that tells me what is wrong
> > with my code. After I delete() the row in the dataset, the dataset is
empty
> > and I get 0 as the value for
> > my 'isDel' variable. What am I doing that I shouldn't be doing, or
> > vice-a-versa?
> >
> > Thanks for any help,
> > Marc Miller
> >
> > Dim sr As New StringReader(CStr(viewstate("dsbldgdata1")))
> >
> > DsBldgData1.ReadXml(sr)
> >
> > ..DsBldgData1.Tables("Profile").Rows(0).Delete()
> >
> > SqlConnection1.Open()
> >
> >
> > Dim iDel As Integer
> >
> > Try
> >
> > iDel = SqlDataAdapter1.Update(DsBldgData1, "Profile")
> >
> > Catch ex As Exception
> >
> > errWindowShow(ex.message)
> >
> > Finally
> >
> > SqlConnection1.Close()
> >
> > End Try
> >
> >
> >
- Next message: Bernie Yaeger: "submitting updates when there's no primary key"
- Previous message: Marina: "Re: Where clause in DataTable.Select method"
- In reply to: Cowboy (Gregory A. Beamer) - MVP: "RE: another delete prob."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|