473,698 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple form postback to update a database

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.IsPostB ack))
{
this.oleDbDAUse r.Fill(this.dsM ain1,"Users");
this.lblUserID. DataBind();
this.txtFirstNa me.DataBind();
this.txtMiddleN ame.DataBind();

..........

}

No error here, but no data is saved either:
private void btnSave_Click(o bject sender, System.EventArg s e)
{
try
{
this.oleDbDAUse r.Update(this.d sMain1);
}
catch (Exception oops)
{
this.txtUserMes sage.Text = "Error occured!<BR>" + oops.ToString() ;
}

}
}

Thanks,
Ray

--
--

/\_Ray Valenti ____ http://www.quixor.com ______
\/ Quixor Flex Systems, Ltd.
Nov 17 '05 #1
1 1431
You have to save your dataset somewhere between requests.
Check my reply to jason post "Dataset persistence" (I
answered as anonymouns).
-----Original Message-----
In a .Net Asp application I am able to retrieve data from an Access db anddisplay in on a web form. How ever during the update function after a pageupdate, the update command does not throw an exception but it does not saveout the changes either. It seems that upon the postback no data exists inthe dataset. I must be missing something.

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

if (!(Page.IsPostB ack))
{
this.oleDbDAUse r.Fill(this.dsM ain1,"Users");
this.lblUserID. DataBind();
this.txtFirstNa me.DataBind();
this.txtMiddleN ame.DataBind();

..........

}

No error here, but no data is saved either:
private void btnSave_Click(o bject sender, System.EventArg s e){
try
{
this.oleDbDAUse r.Update(this.d sMain1);
}
catch (Exception oops)
{
this.txtUserMes sage.Text = "Error occured!<BR>" + oops.ToString() ; }

}
}

Thanks,
Ray

--
--

/\_Ray Valenti ____ http://www.quixor.com ______
\/ Quixor Flex Systems, Ltd.
.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
4753
by: Samantha Smit | last post by:
Hi, I am trying to create a simple asp page that has one command button that updates a database. The URL of the page is like this: http://MyServer.com/Update.asp?UserName=Tom My asp code is like this: %@ Language=VBScript %> <!--#include file="includes/openconnection.asp"-->
1
4121
by: Robert Muchacki | last post by:
Hello all! I'm fighting with this little problem. I'm trying to retrieve data from a table in SQL Server 2k. I'm dead. The only result I get is retrieving the headers of the columns - no data in it actually :/ I'm probably missing something on the way. Could somebody explain me how do I get data and even WHERE I should retrieve it to? Explain like to an idiot - really. Greets,
1
1090
by: Ray Valenti | last post by:
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))
2
1633
by: Myk Quayce | last post by:
I have a small .aspx page that uses old style forms with client-side JavaScript validation. Everything works fine until I try to upate the database with some new information. I must be doing something fundamentally wrong because I can't find any help on this anywhere. Here's my HTML form... <form name="frmNewUser" onSubmit="return validateForm();"> <table> <tr><td>User Name:</td><td><input id="iptUserName" type="text" size="20"...
4
1496
by: ItNerd | last post by:
Someone PLEASE HELP ME!!!!! All I want to do is a simple postback and grab the value from a textbox on clicking a linkbutton like below, but the value is not writing to the screen. I am frustrated with this seemingly simple task. I have enabledviewstate=true on the @Page directive, and I tried using onclick on the linkbutton, nothing. I know the event is firing because I can set the value to a hardcoded string and get it to show. In...
2
7218
by: sanju | last post by:
hi there i am trying to fire an button event in ascx file which interacts with database ,my problem is " i am calling ascx file wiht a button click dynamically when user needs to update database in aspx page , but the the update button in ascx is not firing .. .. but it is working fine when i call ascx like this manually. '<callcontrol:callcontrol id=callcontrol runat="server"/> <%@ Register TagPrefix="callcontrol"...
10
4507
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back (basically have the data binding done in the If NOT IsPostBack Then statement). How come? How does this information get preserved? Which raises another question. Becuase I want to get away from the spaghetti code approach, I would like to create...
2
1903
by: serge calderara | last post by:
Dear all, I have a webform with a calendar control on it. When loaded the calendar is set to the current date. Depending on a criteria from a database field, calendar day cell appears with red background color for the selected month. This is done by using the Calendar_DayRender event. This works fine What I need to do next is that if my user click on either the NextMonth or PrevMonth, I should get the same behaviour for day cells...
27
4611
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res = $doc->loadHTMLFile("./aBasicSearchResult.html"); if ( $res == true ) { $zip = $doc->getElementById('zipRaw_id')->value; if ( 0 != $zip ) {
0
8673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.