MS Oracle ADO.NET provider bug 2?

S

Simon Tobias

The following code returns an InvalidOperationException
syntax error when stepping over the da.FillSchema
statement :

Syntax Error: Expecting ',' or 'FROM' after column alias
or '*'.

The same code works fine using either the MS OleDb data
provider or Oracle's native provider. If I add parentheses
around BUDGET*5, then the code executes as expected.

string connStr = "Data Source=myserv;User
ID=scott;Password=tiger;";
OracleConnection conn = new
System.Data.OracleClient.OracleConnection(connStr);

string sql = "SELECT BUDGET*5 FROM PROJ WHERE
PNUM='P1'";
OracleCommand cmd = new OracleCommand(sql);

cmd.Connection = conn;
conn.Open();
try
{
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter(sql,
conn);
da.SelectCommand = cmd;
da.FillSchema(ds, SchemaType.Source);
ds.EnforceConstraints = false;
da.Fill(ds);
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
conn.Close();
 
K

Kevin Sun [MS]

It seems that ADO.NET manager provider driver check the syntax strickly. It
should not be a problem.

Run the SQL statement as below, does the same problem occur?

SELECT BUDGET*5 AS myField FROM PROJ WHERE
| PNUM='P1'"

Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| Content-Class: urn:content-classes:message
| From: "Simon Tobias" <[email protected]>
| Sender: "Simon Tobias" <[email protected]>
| Subject: MS Oracle ADO.NET provider bug 2?
| Date: Fri, 29 Aug 2003 02:46:49 -0700
| Lines: 37
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNuEngDFKndGUHiS1inYaQQfLbisw==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:59687
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| The following code returns an InvalidOperationException
| syntax error when stepping over the da.FillSchema
| statement :
|
| Syntax Error: Expecting ',' or 'FROM' after column alias
| or '*'.
|
| The same code works fine using either the MS OleDb data
| provider or Oracle's native provider. If I add parentheses
| around BUDGET*5, then the code executes as expected.
|
| string connStr = "Data Source=myserv;User
| ID=scott;Password=tiger;";
| OracleConnection conn = new
| System.Data.OracleClient.OracleConnection(connStr);
|
| string sql = "SELECT BUDGET*5 FROM PROJ WHERE
| PNUM='P1'";
| OracleCommand cmd = new OracleCommand(sql);
|
| cmd.Connection = conn;
| conn.Open();
| try
| {
| DataSet ds = new DataSet();
| OracleDataAdapter da = new OracleDataAdapter(sql,
| conn);
| da.SelectCommand = cmd;
| da.FillSchema(ds, SchemaType.Source);
| ds.EnforceConstraints = false;
| da.Fill(ds);
| }
| catch (Exception Ex)
| {
| MessageBox.Show(Ex.Message);
| }
| conn.Close();
|
 
S

Simon Tobias

-----Original Message-----
It seems that ADO.NET manager provider driver check the syntax strickly. It
should not be a problem.

Run the SQL statement as below, does the same problem occur?

SELECT BUDGET*5 AS myField FROM PROJ WHERE
| PNUM='P1'"

Hi Kevin.

Yes, I'm still seeing the same problem with the above SQL
statement.

Regards

Simon.
 
K

Kevin Sun [MS]

Hey simon,

Thank you for your reply. So we have to add paren add parentheses around
the BUDGET*5, which can make the SQL statement clearer.

Currently, you can use the SQL as below. You can keep an eye out for it in
the future. we are looking at continual improvement, and it's this kind of
feedback that let's us know what things you are trying to do, that we
haven's yet exposed for you.

SELECT (BUDGET*5) AS myField FROM PROJ WHERE > PNUM='P1'"

Keep the information coming.

Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| Content-Class: urn:content-classes:message
| From: "Simon Tobias" <[email protected]>
| Sender: "Simon Tobias" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: MS Oracle ADO.NET provider bug 2?
| Date: Fri, 5 Sep 2003 07:39:11 -0700
| Lines: 20
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNzu3iphrO5ENEURFOy4hPIEJoNNg==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:60313
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
|
| >-----Original Message-----
| >It seems that ADO.NET manager provider driver check the
| syntax strickly. It
| >should not be a problem.
| >
| >Run the SQL statement as below, does the same problem
| occur?
| >
| >SELECT BUDGET*5 AS myField FROM PROJ WHERE
| >| PNUM='P1'"
|
| Hi Kevin.
|
| Yes, I'm still seeing the same problem with the above SQL
| statement.
|
| Regards
|
| Simon.
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top