Thread: Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'


Permlink Replies: 4 - Pages: 1 - Last Post: Feb 25, 2008 9:42 AM Last Post By: kjopc
kjopc

Posts: 4
Registered: 02/24/08
Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'
Posted: Feb 24, 2008 12:35 PM
Click to report abuse...   Click to reply to this thread Reply
[Resolved - http://forums.oracle.com/forums/thread.jspa?messageID=2366331&#2366331

I've created a short video to explain my problem with Oracle and SqlDataSource. If you'd rather watch than read, go see the video at http://www.kencox.ca/video/oracelandsqldatasource.html.

I'm trying to do some extremely simple drag and drop development in Visual Web Developer 2008 with the Oracle 11g database and ODP.NET. According to Oracle, "The data provider can be used with the latest .NET Framework 3.5 version. "

The SELECT statement works fine, but any attempt to use UPDATE via the SQLDataSource UpdateCommand nets me the infamous 'ORA-01036: illegal variable name/number' error.

I wouldn't mind using one of my MSDN Support Incidents to have Microsoft take a look at this issue, but I'm not sure the problem is Microsoft's. It seems like Oracle is doing a poor job in its Visual Studio integration.

Question: Has anyone successfully used an UpdateCommand statement in SQLDataSource against Oracle 11g? If so, let me know!

Below, you see the entire code as generated in Visual Web Developer 2008. To see it in action, check the video at http://www.kencox.ca/video/oracelandsqldatasource.html.

Ken

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ACCOUNTID" HeaderText="ACCOUNTID"
SortExpression="ACCOUNTID" />
<asp:BoundField DataField="ACCOUNTNAME" HeaderText="ACCOUNTNAME"
SortExpression="ACCOUNTNAME" />
<asp:BoundField DataField="ACCOUNTLOCATION" HeaderText="ACCOUNTLOCATION"
SortExpression="ACCOUNTLOCATION" />
<asp:BoundField DataField="ACCOUNTPHONE" HeaderText="ACCOUNTPHONE"
SortExpression="ACCOUNTPHONE" />
<asp:BoundField DataField="ACCOUNTCONTACT" HeaderText="ACCOUNTCONTACT"
SortExpression="ACCOUNTCONTACT" />
<asp:BoundField DataField="ACCOUNTWEBSITE" HeaderText="ACCOUNTWEBSITE"
SortExpression="ACCOUNTWEBSITE" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>"
SelectCommand="SELECT "ACCOUNTID", "ACCOUNTNAME", "ACCOUNTLOCATION", "ACCOUNTPHONE", "ACCOUNTCONTACT", "ACCOUNTWEBSITE" FROM "ACCOUNTS""
UpdateCommand="UPDATE ACCOUNTS SET ACCOUNTLOCATION = 'This Place' WHERE (ACCOUNTID = 4)">
</asp:SqlDataSource>

</form>
</body>
</html>//////////using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

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

}
}

Message was edited by:
kjopc
Mark Williams

Posts: 1,346
Registered: 04/21/98
Re: Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'
Posted: Feb 25, 2008 6:48 AM   in response to: kjopc in response to: kjopc
Click to report abuse...   Click to reply to this thread Reply
Hi Ken,

I took a look at your video. In the exception I see "System.Data.OracleClient" -- this looks like you are attempting to use the Microsoft provider rather than the Oracle provider (ODP.NET) - have you confirmed you are using the Oracle provider?

Regards,

Mark
Alex Keh

Posts: 408
Registered: 01/10/01
Re: Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'
Posted: Feb 25, 2008 9:15 AM   in response to: Mark Williams in response to: Mark Williams
Click to report abuse...   Click to reply to this thread Reply
Ken,
One thing to be aware of is Microsoft has produced Visual Studio database tools and data provider for Oracle. In addition, Oracle has produced its own tools. Knowing which products you are using is important because you want to know which company you should be complaining about. :-)

In your video, you are using all Microsoft tools and data provider, not Oracle's.

I would recommend using Oracle Developer Tools (ODT) for VS and ODP.NET since these products are much better integrated with .NET and Oracle.

ODP.NET uses Oracle.DataAccess.Client namespace. System.Data.OracleClient belongs to the MS provider for Oracle, which Mark pointed out. If you drag and drop DB objects using ODT, it will generate ODP.NET code for you (and give you more data source wizard options as well).

You can download the latest 11g version of ODP.NET and ODT here:
http://www.oracle.com/technology/software/tech/windows/odpnet/index.html

These support .NET 3.5 and VS 2008.
kjopc

Posts: 4
Registered: 02/24/08
Re: Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'
Posted: Feb 25, 2008 9:27 AM   in response to: Mark Williams in response to: Mark Williams
Click to report abuse...   Click to reply to this thread Reply
Hi Mark,

That was it! Doh!

Once I added references to ODP.NET, I started getting the option when adding the connection to use Oracle Database (Oracle ODP.NET) which is what I wanted.

For others, the connection string in the web.config needs to use the Oracle.DataAccess.Client as shown below


<connectionStrings>
<add name="ConnectionString1" connectionString="Data Source=192.168.1.104/orcl;Persist Security Info=True;User ID=system;Password=xxxpwd!!;"
providerName="Oracle.DataAccess.Client" />
</connectionStrings>

Thanks very much!

Ken

kjopc

Posts: 4
Registered: 02/24/08
Re: Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'
Posted: Feb 25, 2008 9:28 AM   in response to: Alex Keh in response to: Alex Keh
Click to report abuse...   Click to reply to this thread Reply
Hi Alex,

You're right, I was using Microsoft's tool by mistake.

Thanks!!

Ken
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums