473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Gridview Rowupdating

5
Hi,

Can someone help me to correct my code to make my Gidview update.

Here is my code below:
Expand|Select|Wrap|Line Numbers
  1. protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
  2.     {
  3.         string unqNo = GridView1.DataKeys[e.RowIndex].Value.ToString();
  4.         string salMod = GridView1.Rows[e.RowIndex].Cells[6].Text;
  5.         string applGa20 = GridView1.Rows[e.RowIndex].Cells[7].Text;
  6.         string updateQuery = string.Format("UPDATE SSU_EMPDETAILS SET SALARY_MODELING = '{0}',APPL_GA20='{1}' WHERE UNIQUE_NO = {3}",salMod,applGa20,unqNo);
  7.         GridView1.EditIndex = -1;
  8.         BindData(updateQuery);
  9.   }
  10.  
  11. private void BindData(string Query)
  12.     {
  13.         OracleConnection oCon = new OracleConnection("Data Source=PSM1;User ID=C****DM;Password=C****DM");
  14.         OracleCommand oCmd = oCon.CreateCommand();
  15.  
  16.         oCmd.CommandText = "Select * from SSU_EMPDETAILS";
  17.  
  18.  
  19.         oCmd.CommandType = CommandType.Text;
  20.  
  21.         OracleDataAdapter oDa = new OracleDataAdapter(oCmd);
  22.         System.Data.DataSet oDs = new DataSet();
  23.         oDa.Fill(oDs);
  24.         GridView1.DataSource = oDs;
  25.         GridView1.DataBind();
  26.     }
Feb 17 '10 #1
3 3949
Frinavale
9,735 Expert Mod 8TB
I don't know what you are doing.
You are passing a String into your DataBind method...the string contains the SQL query that I'm assuming will update your table....but you never use it.

Why?

-Frinny
Feb 17 '10 #2
Nonki
5
Hi,

Thanks foe viewing my code but I have changed it completely, not using it anymore.
Feb 18 '10 #3
CroCrew
564 Expert 512MB
So, is your question answered?

If not could you provide more information on what exactly you are trying to accomplish and what your current results are with the code you have.

Thanks,
CroCrew~
Feb 18 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: fatmosh | last post by:
I have a GridView that is pulling data from a SQL database using a Select command. I would like to use GridView's built-in "Edit, Update, Cancel" functionality because it is very handy. However,...
3
by: slemen | last post by:
The controls (textboxes) in the gridview row being updated have the old, pre user updated values in the RowUpdating event. Does anyone have an idea why? Thank you, Scott
1
by: s.bussing | last post by:
Hi, I have been struggling with the GridView the whole day, but can not get this solved. The rowupdating event in my Gridview doesn't give me the new values only the old ones. In my GridView I...
1
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
Hi, I have a gridview which I added a <asp:CommandField EditText="E" CancelText="C" UpdateText="U" ButtonType="Link" ShowEditButton="True" /> my gridview looks like this <asp:GridView...
0
by: =?Utf-8?B?SGF3aw==?= | last post by:
Hello, I have the need to verifiy a field in a gridview for a duplicate value against a database before the update takes place. I was thinking that the gridview1.rowupdating would be a good place...
9
by: John007 | last post by:
I am using a SQLDataSource to populate my gridview in ASP.Net 2.0. When I hit Edit, the textboxes appear and I am able to edit my values. When I hit Update, the changes are not saved, and there is no...
1
by: Steve Kershaw | last post by:
Hi, I'm using the RowUpdating() event of an updatable GridView. I need to see the values of the columns in the updated row. There has got to be a way to do this! Any suggestions? Thanks...
3
by: nick chan | last post by:
Hi i run into some difficulties getting rowupdating to fire when clicking Update link/button on gridview I set datasource at runtime, basically a datatable Edit and Cancel works. I don't know...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.