Simple form postback to update a database

  • Thread starter Thread starter Ray Valenti
  • Start date Start date
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
 
You have to save your dataset somewhere between requests.
Check my reply to jason post "Dataset persistence" (I
answered as anonymouns).
 
Back
Top