Updating an Oracle table

 I have the following code trying to update a record.

My select command works right and brings out 1 row.  When I click on the "edit" link/button, the edit template opens with 2 editable fields. After entering new information, once I hit update, 1)The answer.aspx screen opens up as per the PostBackUrl="answer.aspx" command within the "update" tag. If I do not mention this postbackurl, an empty white screen opens up.

Either way, updates to the database is not happening.

It should be talking to the the Oracle database ,coz my select seems to be working fine. If you notice my update command, I have tried updating with static value too..without success.

Please help.I'm getting tired of trying to figure this out.

 

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="formview.aspx.vb" Inherits="formview" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Question</title>
<link href="layout.css" rel="stylesheet" type="text/css" />
<link href="main.css" rel="stylesheet" type="text/css" />
<meta content="test"/>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" OnItemUpdating="FormView1_ItemUpdating" Width="56px">
<ItemTemplate>
<table border="1" cellpadding="0" cellspacing="0" style="z-index: 101; left: 0px; position: absolute; top: 0px; height: 650px;width:797px">
<tr>
<td style="width: 793px">
<div id="page" style="z-index: 102; left: 0px; top: 0px; height: 800px">

<div id="content">
<div class="item">
<%--BEGIN BREADCRUMB --%>




<%# Eval("QUESTION_NO") %><h3><%# Eval("QUESTION") %></h3><br /><br />
<%# Eval("QUESTION_ANSWERED") %><br /><br />
<%# Eval("COMMENTS") %>

</div>

</div>

</div>
</td>
</tr>
<tr><asp:LinkButton ID="EditButton" Text="Edit"
CommandName="Edit" runat="server" /></tr>
</table>



</ItemTemplate>
<EditItemTemplate>
<table>
<tr><td align="right"><b>ID:</b></td><td><%# Eval("ID") %></td></tr>

<tr>
<td align="right">
<b>Question Answered?:</b>
</td>
<td>
<asp:TextBox ID="QUESTION_ANSWERED123" Text='<%# Bind&#13;&#10;("QUESTION_ANSWERED") %>' runat="Server" />

</td>
</tr>

<tr>
<td align="right">
<b>Comments:</b>
</td>
<td>
<asp:TextBOX Height="200px"
MaxLength="4000" TextMode="MultiLine" Width="400px" ID="COMMENTS123" Text='<%# Bind&#13;&#10;("COMMENTS") %>' runat="Server" />
</td>
</tr>
<tr>
<td colspan="2">



<asp:LinkButton ID="UpdateButton" Text="Update"
CommandName="Update" runat="server" PostBackUrl="answer.aspx" />


<asp:LinkButton ID="CancelUpdateButton" Text="Cancel"
CommandName="Cancel" runat="server" />
</td>
</tr>
</table>
</EditItemTemplate>


</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringUpdt %>"
ProviderName="<%$ ConnectionStrings:ConnectionStringUpdt.ProviderName %>"
SelectCommand="select ID,QUESTION,QUESTION_NO,QUESTION_ANSWERED,COMMENTS FROM TABLE1 WHERE question_no=2 and user_id='USER1' and id=437"
UpdateCommand="UPDATE
TABLE1 SET COMMENTS='TESTDEC19' WHERE ID=437">


</asp:SqlDataSource>

</div>
</form>
</body>
</html>

  

My code behind file has:

 

Imports System.Data.OracleClient
Imports System.IO
Imports System.Text
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.Security
Imports System.Web.h
Partial Class formview
Inherits System.Web.UI.Page


Protected Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e As FormViewUpdateEventArgs)
'SqlDataSource1.UpdateParameters("COMMENTS").DefaultValue = DirectCast(FormView1.FindControl("COMMENTS"), TextBox).Text
'SqlDataSource1.UpdateParameters("QUESTION_ANSWERED").DefaultValue = DirectCast(FormView1.FindControl("QUESTION_ANSWERED"), TextBox).Text

SqlDataSource1.Update()
End Sub

End
class

 


0
just_life
12/19/2008 8:42:02 PM
asp.net.oracle 2269 articles. 0 followers. Follow

6 Replies
649 Views

Similar Articles

[PageSpeed] 9

 Bump.Hoping to catch someone's expert opinion.

0
just_life
12/20/2008 2:46:54 AM

My initial guess would be you don't have an UpdateCommand set in your SqlDataSource.


Life would be so much easier if we only had the source code.
0
jfmccarthy
12/22/2008 7:31:19 PM

 I have included all my code in the original post and it does have the update command. My sqldatasource is as below and it does have the Updatecommand, unless it ought to have something more.

  

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringUpdt %>"
ProviderName="<%$ ConnectionStrings:ConnectionStringUpdt.ProviderName %>"
SelectCommand="select ID,QUESTION,QUESTION_NO,QUESTION_ANSWERED,COMMENTS FROM TABLE1 WHERE question_no=2 and user_id='USER1' and id=437"
UpdateCommand="
UPDATE TABLE1 SET COMMENTS='TESTDEC19' WHERE ID=437">
 
0
just_life
12/22/2008 8:59:06 PM

 I have finally decided to chuck the formview and get my stuff done using database procedures.

0
just_life
12/23/2008 5:37:51 PM

Hi,

 

I have the same problem. Trying to update an Oracle table using code below but nothing happens. When I use the same UPDATE query in Query builder in Visual Studio 2008 the table is updated. Do I mis something here.

 

 

    try
        OracleConn := new OracleConnection;
        OracleConn.Connectionstring := 'User Id=SCHULDHULP;Password=pass; Data Source=Omgeving;';
        OracleConn.Open;
        myOracleTransaction := OracleConn.BeginTransaction();
        cmd := new OracleCommand;
        cmd := OracleConn.CreateCommand;

        cmd.Connection := OracleConn;  
        cmd.CommandText := "UPDATE    AANVRAGER SET GEHEIM = 'Nee' WHERE (AANVRAGER.BSN = 9675463772)";
  
        cmd.ExecuteNonQuery();
        OracleConn.BeginTransaction.Commit;
    finally
        OracleConn.Close();
        OracleConn.Dispose();
  
0
Willemt
4/20/2009 9:04:10 PM

 I have a workaround for this issue.  The UpdateCommand is basically requiring all the fields in the select statement be present in the Update event if not used.  This is crap.

 Extra Note:  If your NewValues are always the same as your OldValues, then you are rebinding your data somewhere before the execution of the Grid_Update.

 

protected void Grid_Update(object sender, GridViewUpdateEventArgs e)
{
string SQLData = "UPDATE DataBaseName SET Name = '" + e.NewValues[1].ToString() + "' where ID = '" + e.OldValues[0].ToString() +"'";
DoData(SQLData); //This line calls the below function for the actual update
GridName.EditIndex = -1; //This line moves the gridview out of edit mode
e.Cancel = true; //***IMPORTANT*** This cancels the SQLDataSources actual UpdateCommand which causes the error
GridBind(); //This is just rebinding my grid

}

public bool DoData(string a)
{
string SQLString;
System.Data.OleDb.OleDbConnection conn;
System.Data.OleDb.OleDbDataReader rdr;
System.Data.OleDb.OleDbCommand cmd;

string ConnString;

ConnString = "My DB Connection String";
conn = new System.Data.OleDb.OleDbConnection(ConnString);

SQLString = a;

cmd = new System.Data.OleDb.OleDbCommand(SQLString, conn);
conn.Open();

rdr = cmd.ExecuteReader();

rdr.Close();
conn.Close();
return true;
}
  
0
CHolland99
4/27/2009 1:52:19 PM
Reply:

Similar Artilces:

urgent: .NET Provider for Oracle or Oracle Data Provider for .NET
If I want to access Oracle DB in ASP.NET application, and I am using .NET Provider for Oracle or Oracle Data Provider for .NET, should I have to install OracleClient on my .NET server? Is there other choice? Thank you very much.Johnson Johnson2007:should I have to install OracleClient on my .NET server?  You have to options1. install the ODP.NET on your web serverOR2. put the oracle assemblies in your BIN directory   Hi jimmy,Thank you for you reply. Because I could not find a server right now, I should test it first before I agree or disagree with you, as most articles I...

.NET Oracle Provider
Hi all,I am using .NET 2.0 Frameworks Oracle provider and it does not have a OracleDbTypes Type for me to use. I would like to create a parameter that is of the Oracle type NVARCHAR, but it seems I can only use DbTypes, which does not have this. If I used DbTypes.String, would this be ok, otherwise, how else can I be more specific about the Oracle Parameter data type?Thanks  can u explain which type of data u r going to storeThank uBaba Thank uBabaPlease remember to click "Mark as Answer" on this post if it helped you. What's your version of ODP? You have OracleD...

Update only changes made in the SQL Table to Oracle Table
- I need to Update changes made in the SQL Table to Oracle Table. I am using Update Trigger along with Linked Server Concept. Here I need the Query which will update only the columns which underwent changes.I have used the command                 IF (SUBSTRING (COLUMNS_UPDATED (), 1, 1)) > 0                                     &...

Update table on Oracle
Hi, In Sybase, when I want update a table with value from another table, I write : UPDATE table1 as t1, table2 as t2 SET t1.col1=t1.col2*t2.col3 WHERE t1.col1=t2.col1 AND t1.col2=t2.col2 ; But it isn't possible to do this in Oracle because It must have a single table in the update instruction ! Have you got a solution to do this with Oracle ? Thanks J�r�me P.S.: Sorry for my accent..... ;) >In Sybase, when I want update a table with value from another table, I >write : >UPDATE table1 as t1, table2 as t2 >SET t1.col1=t...

Return an Oracle Ref Cursor to a .NET DataReader object by using the .NET Managed Provider for Oracle
Hello, I am wondering if anyone in this community knows the shorter way to return an Oracle Ref Cursor to a .NET DataReader object by using the .NET Managed Provider for Oracle, something likereturn (IDataReader) SqlHelper.ExecuteReader(ConnectionString, "GET_ACCOUNT", Id); instead of using the way below (look at the C# code) Stored Procedure create or replace PROCEDURE "GET_ACCOUNT" ( p_ID IN ACCOUNT.ID%type, retCursor OUT SA.MYGEN.sqlcur ) IS BEGIN OPEN retCursor FOR SELECT ID, NAME FROM ACCOUNT WHERE ID = p_ID ; ...

Oracle ODP.net mulitple Oracle Client
To connect to the oracle database using ODP.net, the applicate must add the dll file called Oracle.DataAccess. There are a lot of version of Oracle.DataAccess. As I know, if the client use Oracle Client 10g Release 2. If the client use Oracle Client 10g Release 2, the application also have to use the Oracle.DataAccess the come from Oracle Client 10g Release 2.  My question is that there are any method to add more than one Oracle.DataAccess version in my product to support multiple OracleClient.   That should automatically happen for the most part.  Oracle's ODP.NET i...

Which .Net Provider for Oracle 9i Microsoft or Oracle
Can anyone provide me pros and cons of provider to access Oracle Database ? I am aware of Microsoft Provider and Oracle Provider. Microsoft http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/manprooracperf.asp Oracle http://otn.oracle.com/software/tech/windows/odpnet/utilsoft.html I guess you can use either. But as some post suggests, if both installed, then MS ODP will not work. I've been using DataDirect Technologies Connect for .Net and Oracle. It's not free, so it depends on your budget. The speed improvements were great for us, and it's ni...

Oracle Error while trying to connect to oracle tables
------=_NextPart_000_0029_01C1EE17.39628160 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have this program that will work for me as I have my environment = variables set properly in my .profile. Problem is, this needs to be run = by lots of people and I'm trying to avoid having all these people have = to change their .profiles to add the Oracle environment variables. Let's = just say, some of these people are at level -1 on an AIX box and I don't = have root access to make the changes myself. Here is the part ...

which is shou i use? Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NET
Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NETI am confused?Which is better or which one should I use?BTW, I am going to use .net 2.0 with oracle 9. Can anyone tell me what shou I use for working with oracle database?Thanks very much in advance!Justin Oracle's data provider has more functionality than Microsoft's.If your doing transaction processing you can have SAVEPOINTs, which Microsoft's data provider does not provide.Also, Oracle has PL/SQL Associative Arrays which are very powerful.Oracle also allows you to bind parameters by name and pos...

Replicating Oracle to Oracle
How do I use replication server to replicate between two oracle databases when some of the tables to be replicated has no primary key or unique index constraint? We'll apreciate your contributions. Femi Olumofin Covenant Visions Int'l +234-1-4976764 In Sybase, you can create clustered index on the unique key in the table and use the unique key as your primary key in the replication definition. It should work in oracle as well since that functionalilty is built in repserver and not Oracle. Bawoni Femi Olumofin wrote: > How do I use replication server to re...

Updating multiple tables in Oracle
Hi. I have a PB component in Jaguar 3.5 C3 and one of its methods performs an updating of several tables (4 to 8) in an Oracle 8.1.5 database. If I use ODBC driver it works ok, but with OCI 8 driver, Jaguar service always crashes in the second Update, no matter the table it's updating. The updates are made with a datastore and calling the Update() function. Any ideas about how can I solve the problem? Thanks in advance. What version of SQLNet are you using? There is a requirement to be on a certain version of SQLNet for C3.\ Jim - what version is this? Car...

vb.net oracle update
Hello, I'm trying to attempt my first oracle update in code. This is an update off of a gridview. Below is my code. When I run I get this error: ORA-00911: invalid character. I checked the values of strPassW, txtSecurity and txtUserId and they are all valid. Can you tell me what is wrong? Thanks  NewOracleConnection.Open() Dim trans As OracleTransaction = NewOracleConnection.BeginTransaction(IsolationLevel.ReadCommitted) Dim cmd As New OracleCommand("Update ZSIGNON set UserPassWord=?, SecurityLevel=? " & _ "Where UserId=?", New...

Replication from Oracle to Oracle
I'm about replicating between two Oracle 7.0 databases. What other Sybase tools do I need apart from Replication agent for Oracle? Thank you. Femi Olumofin Femi Olumofin wrote: > > I'm about replicating between two Oracle 7.0 databases. What other Sybase > tools do I need apart from Replication agent for Oracle? You'll also need the Replication Server product (duh, Mark?!?!). -- Mark Parsons Pegasys Ltd Hi Femi: Besides Rep Server, you need ASE (Adaptive Server Enterprise), DCO (Direct Connect for Oracle), and CIS (Component Integration ...

ORACLE NEWBIE PROBLEMS: ORACLE DOES NOT RECOGNIZE AN EXISTING TABLE!
Hi, my first experience with Oracle: First, I connect to the database and get all table names: opened Oracle with MYDUMMY1 ...... table :PATIENTS ..... dbh=DBI::db=HASH(0x1756dc) then try to do a SELECT FROM that table and get: DBD::Oracle::db prepare failed: ORA-00942: table or view does not exist (DBD ERROR: error possibly near <*> indicator at char 14 in 'SELECT * FROM <*>PATIENTS') [for Statement "SELECT * FROM PATIENTS"] at alarmtst.pl line 20. DBD::Oracle::db prepare failed: ORA-00942: table or view does not exist (DBD ERROR: error pos...

Web resources about - Updating an Oracle table - asp.net.oracle

Wikipedia talk:Updating information - Wikipedia, the free encyclopedia
This is brilliant! It would probably work best for elections etc in minor locations. For something that's well-known like a US predidential election, ...

8 Tools For Updating Facebook Offsite
Applications for receiving Facebook updates and notifications without having to keep the site open in a browser keep coming out. Here are eight ...

Updating how Cost per Click is Measured on Facebook
To help advertisers better understand how their ads perform, we're updating the definition of cost per click on Facebook. Learn what the change ...

Updating Your App for iOS 9: What You Need to Know
Updating Your App for iOS 9: What You Need to Know

Facebook for iPhone 3.0 to Include Page Updating
... who want to more easily update their Facebook Pages on the go: Facebook for iPhone 3.0 , which should be released soon, will include Page updating, ...

Updating trends on mobile
Trends are a great way to find out what people are talking about on Twitter at a given moment and at a single glance. Starting today, we’re making ...

Delhi Metro Fare Calculator and Auto-Updating Map on the App Store on iTunes
Get Delhi Metro Fare Calculator and Auto-Updating Map on the App Store. See screenshots and ratings, and read customer reviews.


LOOT v0.7.0 for Mod Organizer: Updating and Installation - YouTube
A new version of LOOT (Load Order Optimisation Tool) has been released with some major upgrades. This video tutorial shows how to upgrade and ...

Freeview launches auto-updating EPG
Shows running late won't phase new Freeview PVRs, but the new Australian EPG doesn't work with all Freeview gear.

Resources last updated: 1/23/2016 3:35:24 AM