.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Update datareader

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :Sql Server

hi all,

My problem is i retriving previous page data through querystring and data reader.how to update this data.please anybody help me

 OleDbConnection cn = new OleDbConnection(ConfigurationSettings.AppSettings["connec"]);

    string strSQL = " SELECT * from Route_Expenses WHERE ID = " + RouteID;
    OleDbCommand cmd = new OleDbCommand(strSQL, cn);
    OleDbDataReader dr = cmd.ExecuteReader();
    if (dr.Read())

      //  ID.Text = dr["FirstName"].ToString();
      //dt_transdt.Text = dr["Trans_date"].ToString();
      dt_transdt.Text = DateTime.Now.ToString();
      cmb_driver1.Text = dr["Driver1"].ToString();
      cmb_Driver2.Text = dr["Driver2"].ToString();
      cmb_Driver3.Text = dr["Driver3"].ToString();
      cmb_Route.Text = dr["Route_Name"].ToString();
      cmb_Vehicle.Text = dr["Vehicle_No"].ToString();
      txt_omr.Text = dr["OMR"].ToString();
      txt_cmr.Text = dr["CMR"].ToString();
      lbl_kmrun.Text = dr["KM_Run"].ToString();
      txt_hsdqty.Text = dr["HSD_Qty"].ToString();
      txt_hsdamt.Text = dr["HSD_Amt"].ToString();
      txt_tollgate.Text = dr["Toll_Gate_Exp"].ToString();
      txt_pc.Text = dr["PC_Exp"].ToStr

View Complete Post

More Related Resource Links

ASP.Net Gridview Edit Update Cancel Commands

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Update Vs SystemUpdate

Many of you might noticed that share point ListItem has Update() method as well as SystemUpdate().

What is the difference between these two methods and why MOSS has two different APIs for updating an ListItem

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

>>>How to update multiple rows of gidview by one click



I want to add multiple rows of a gridview if the data for multiple fields are same.

Idea for this is that a user may search a record with some parameter e.g. Sector, plot.

For example 15 records being displayed in gridview.

There should be checkbox before every row and if user wants to update Plot and Flat No that is same for 10 rows out of 15 so he will check the rows and update.

For this a dialog box should appear asking for the parameter i.e. Plot and Flat or something else next time may be it will be City or country. Moreover, there is already an Edit button to update records, when user click it another page open for the record to be updated and whatever he wants to update, it updates.

Hope everone understand the scenario.

I don't want to disturb the already provided Edit functionality and want to provide same record to be updated.

Any idea in this regard would be appreciated.

Visual Studio closes itself by opening aspx-Page designer after Windows Update


Hey Guys,

I've a problem with my Visual Studio.

On the 13th of August 2010 i installed a Windows update on my vista sp2 pc. For this date my Visual Studio 2008 sp 1 always has closed itself by opening an aspx-page in designer view. There is no error message just closing the window. I restored a backup of my windows from the time before updating it and it helped, i could open aspx pages in the design view till the update has been installed again automatically after rebooting the pc. I can't disable windows updates, cause it's my pc at work and safety is very important. I hope you could help me out of this disaster.



Update net frame 3.5.


I use visual studio 2008 but It's only use net frame work 2.0, Can I update and use net frame work 3.5 for Visual Studio 2008 ? Please help me !


update/delete not working on server only


my aspx page works in VWD, and everything works on the server EXCEPT update and delete sql functions. any ideas?


C++ at Work: Persisting View State Update, Using Managed Extensions in a DLL


This month marks the 11th anniversary of my column and the inauguration of a new title: C++ At Work. We're also adding a new bimonthly column, "Pure C++," by my pal Stan Lippman, one of the great C++ Masters.

Paul DiLascia

MSDN Magazine February 2005

{ End Bracket }: Microsoft Java Virtual Machine Update


In a settlement agreement reached in January 2001 to resolve a dispute over the Microsoft distribution of its Java implementation, Sun Microsystems and Microsoft agreed to limit the duration of the time Microsoft would use Sun's source code and compatibility test suites to support the Microsoft® Java Virtual Machine (MSJVM).

Brian Keller

MSDN Magazine October 2004

Editor's Note: Topic Coverage Update


Over the past couple of months, we've received a lot of mail about our recent issues. Although opinions are mixed, several people have let us know that they feel we've covered too much forward-looking content recently.

Joshua Trupin

MSDN Magazine July 2004

ClickOnce: Deploy and Update Your Smart Client Projects Using a Central Server


ClickOnce is a new deployment technology that allows users to download and execute Windows-based client applications over the Web, a network share, or from a local disk. Users get the rich interactive and stateful experience of Windows Forms, but still have the ease of deployment and updates available to Web applications. ClickOnce applications can be run offline and support a variety of automatic and manual update scenarios.Learn all about it here.

Brian Noyes

MSDN Magazine May 2004

SQL Server CE: New Version Lets You Store and Update Data on Handheld Devices


Handheld device users need to be able to synchronize with a main data store when it's convenient and, preferably, when the back-end database server isn't busy. SQL Server 2000 Windows CE Edition allows you to build a traveling data store that can be displayed and run on a variety of devices. SQL Server CE supports a subset of the full SQL Server package, and can be used as a standalone server or in tandem with SWL Server and IIS. The architecture of SQL Server CE, along with data manipulation, synchronization, and connectivity issues, are discussed in this article. Topics such as making your data public, choosing the right type of replication, and handling errors are also covered.

Paul Yao and David Durant

MSDN Magazine June 2001

Add, Edit, update, Delete gridview

The article Add, Edit, update, Delete gridview was added by anjankant on Friday, July 09, 2010.

Thousandas operation we can do on Gridview control. Here I as explaining how we can add new recored and edit of existing record and delete a record in Gridview. Step1 : You can add this gridview in your aspx form. Here some events of Gridview are fired

update user status in database when ever user logoff


actually i came across this senario for new project where userstatus must change to log off when ever he do fallowing activity.I have maintain user status when he log in to web based system.

Activities are


1.user click log off

2.or user click browser close button or close brwoser tab.

3.or Fource fully shut down his Pc

I am able to get first 2 but not the last one.I googled it but not get any satified ans for that.

I m looking for guidens for this. Any help is grate help for me as i want it.And also other suggesstion also welcomed.

thanks in advance


Help ~~ How to Update Binary Image on Formview

Hi All ~~ I'm confused, Can i have some help please... Thanks
Database: Books
uid dataType uniqueidentifier
Cover dataType image 
aspx :
 <asp:FormView ID="FormView1" runat="server" BackColor="LightGoldenrodYellow"   BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataKeyNames="uid"     DataSourceID="SqlDataSource1" ForeColor="Black" Width="525px">
         <table class="table_width">
                 <td class="imageWidth">
                     <asp:Image ID="Image1" runat="server" Height="245px" 
                                       ImageUrl='<%# IIF(Eval("Cover") Is DbNull.Value, "~/Styles/Global/CFZ-No-Images.png", Eval("uid", "~/ImageServices.ashx?BooksID={0}")) %>' Width="180px" />
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend