Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > gridview update

Reply
Thread Tools

gridview update

 
 
Bobby Bobby is offline
Junior Member
Join Date: Dec 2007
Posts: 1
 
      12-11-2007
Hi I have problem with Upgate grid view could you please help me with this.when i write the query in toad it works good but when i use it in the code it returns run time error? Can you please help me

Thanks in Advance

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Oracle.DataAccess.Client;

public partial class EDIT_UPDATE : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
BindData();
}
public void BindData()
{
OracleConnection cn = new OracleConnection();
OracleCommand cm = new OracleCommand();
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter();
try
{
cn.ConnectionString = "Data Source=MISC;User ID=SO;Password=SO";
cn.Open();

cm.Connection = cn;
cm.CommandType = CommandType.Text;
cm.CommandText = "select call_id,call_status,member_id from WORLD_SERIES_CALL";

da.SelectCommand = cm;
da.Fill(ds, "test");
GridView1.DataSource = ds;
GridView1.DataBind();
}
catch { throw; }
finally
{
cn = null;
cm = null;
}
}

protected void GridView1_PageIndexChanged(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
BindData();
}


protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BindData();
}
protected void GridView1_CancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BindData();
}

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{


string lblCALL_Id = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("lblCALL_ID")).Text;
string lblCALL_STATUS = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("lblCALL_STATUS")).Text;
string txtMEMBER_ID = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtMEMBER_ID")).Text;

OracleConnection cn = new OracleConnection();
OracleCommand cm = new OracleCommand();
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter();
try
{
cn.ConnectionString = "Data Source=MISC;User ID=SO;Password=SO";
cn.Open();

cm.Connection = cn;
cm.CommandType = CommandType.Text;
cm.CommandText = "UPDATE world_series_call SET"
+ "call_status ='" + lblCALL_STATUS + "'"
+ " WHERE call_id =" + lblCALL_Id + "";

cm.ExecuteNonQuery();
GridView1.DataBind();

}
catch { throw; }
finally
{
cn=null;
cm=null;
}
}
private string _SortExpression;
public string SortExpression
{
get { return _SortExpression; }
set { _SortExpression = value; }
}

private string SortDirection
{
get { return ViewState["SortDirection"] as string ?? "ASC"; }
set { ViewState["SortDirection"] = value; }
}
public void Gridview1_sorting(Object sender, System.Web.UI.WebControls.GridViewSortEventArgs e)
{

if (SortDirection == "ASC")
{
SortExpression = e.SortExpression.ToString();
SortDirection = "DESC";
}
else
{
SortExpression = e.SortExpression.ToString();
SortDirection = "ASC";
}

BindData();
}

}
 
Reply With Quote
 
 
 
 
Obinna. N Obinna. N is offline
Junior Member
Join Date: Dec 2007
Posts: 5
 
      12-12-2007
Click here:fmahomed.jim98.hop.clickbank.net
email:

Revealed:
The Top Secret
"Psychological Triggers"
That Can Turn You Into
A Health Addict -Today.

Master Hypnotist exposes the "Persuasion Technologies"
that Professional Manipulators have used on you for
years so that you can take control of your health.
by Jim Katsoulis, creator of the Addictive Health Plan

:Now The Power Is In YOUR Hands

CLICK HERE: http://fmahomed.regsmart.hop.clickbank.net/



Self-Conscious, Dejected 28 yr. old Man Finds Non-Surgical Way to Completely Eliminate His 'Man Boobs' In Just Under 22 Weeks & Is Now Releasing His Man-Boob-Beating Method To Other Gyno Sufferers for The Very First Time..."



Now The Power Is In YOUR Hands To End The Feelings of Helplessness & Get Rid of Gynecomastia For Good With This Simple, Non-Surgical Plan...
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update On The Windows Phone 7 Update Update Lawrence D'Oliveiro NZ Computing 2 02-25-2011 08:03 AM
GridView Update doesn't update on first postback Evan M. ASP .Net 1 04-18-2007 03:32 PM
1 global update button to update all rows in Gridview mesut ASP .Net 0 02-19-2007 02:00 PM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
GridView in a GridView Nalaka ASP .Net 6 12-05-2005 05:48 PM



Advertisments