New row is a no-show, Web Developer Express Edition 2005

R

RKT

Problem: New row not showing up until forcing a second postback.

I am using:

- Visual Web Developer 2005 Express Edition
- SqlDataAdapter
- The embedded MS SQL Server

(As you may know, this IDE heavily encapsulates database interface internals
when you
generate a derived DataSet. So, I cannot reuse techniques that worked in VS
dotNET 2003
if I want to use these alledgedly 'convenient' generated classes.)

Sequence:

0. Startup.
1. When direct to the page containg codebehind below, CreateChildControls is
invoked and shows the number of records correctly.
2. Press "Button_GET", Button_GET_Click inserts new row.
3. Page is reloaded due to button click, CreateChildControls gets called,
BUT DOES NOT SHOW NEW ROW.
4. Press "Button_GET" again, no row added because 'FileUpload_IMAGE.HasFile'
is false, BUT...
5. Page is again reloaded due to button click, CreateChildControls is
invoked, NOW SHOWS NEW ROW.

So, seems the update is dependent on the page load, but notice I'm using
'local'
instances of datasets, adapters, tables and views. I would have thought the
generated internals would take care of what we used to call 'flushing'
changes
to the database. (Have tried every permutation imaginable of Fill(),
Clear(), cnn.Close(),
ClearBeforeFill() to shake loose some understanding...)

// -----------------------------------------------------

protected override void CreateChildControls()
{
DataSet_TEST ds = new DataSet_TEST();

TESTTableAdapter ta = new TESTTableAdapter();

ta.Fill(ds.TEST); // ds.TEST is the typed table, IDE generated the
wonderful mnemonic(s).

DataView view = ds.TEST.DefaultView;

view.RowFilter = "member_index = " + m_lMemberIndex.ToString();

for (int i = 0; i < view.Count; i++)
{
DataSet_TEST.TESTRow row = (DataSet_TEST.TESTRow) view.Row;

// DO NOT SEE THE NEW ROW HERE UNTIL FORCE ADDITIONAL Page_Load.
}
}

// -----------------------------------------------------

protected void Button_GET_Click(object sender, EventArgs e)
{
if (FileUpload_IMAGE.HasFile)
{
TESTTableAdapter ta = new TESTTableAdapter();

ta.Insert(
<member>,
...,
<member>);

// Have tried explicit Update() here. NG.
// ta.Insert is indeed working w/o it.
}
}

// -----------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top