Simple form postback to update a database

R

Ray Valenti

In a .Net Asp application I am able to retrieve data from an Access db and
display in on a web form. How ever during the update function after a page
update, the update command does not throw an exception but it does not save
out the changes either. It seems that upon the postback no data exists in
the dataset. I must be missing something.

How you post the data from an edited user page back to the database?


if (!(Page.IsPostBack))
{
this.oleDbDAUser.Fill(this.dsMain1,"Users");
this.lblUserID.DataBind();
this.txtFirstName.DataBind();
this.txtMiddleName.DataBind();

..........

}



No error here, but no data is saved either:


private void btnSave_Click(object sender, System.EventArgs e)
{
try
{
this.oleDbDAUser.Update(this.dsMain1);
}
catch (Exception oops)
{
this.txtUserMessage.Text = "Error occured!<BR>" + oops.ToString() ;
}

}
}

Thanks,
Ray
 
E

Esteban Felipe

You have to save your dataset somewhere between requests.
Check my reply to jason post "Dataset persistence" (I
answered as anonymouns).
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top