Hi,
I am creating a c# application which allows the user to enter sql. I have a problem when executing a with statement; e.g.
WITH x
AS (
SELECT level id
FROM dual
connect BY level <= 10
)
SELECT * FROM x
There are 0 rows returned for some strange reason.
I am using the ODBC driver & here is the code snippet.
myConnection = new OdbcConnection(ConStr);
myCommand = new OdbcCommand(SQL, myConnection);
myCommand.Connection.Open();
myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
for (int i = 0; i < myReader.FieldCount; i++)
{
listData.Columns.Add(myReader.GetName(i), 100, HorizontalAlignment.Center);
}
while (myReader.Read()) // reads rows
{
//if (!myReader.IsDBNull(0))
listData.Items.Add(myReader.GetValue(0).ToString());
for (int i = 1; i < myReader.FieldCount; i++) // reads columns
{
listData.Items[dispInd].SubItems.Add(myReader.GetValue(i).ToString());
}
Any comments/thought/help will be much appreciated. TIA, Joe
I am creating a c# application which allows the user to enter sql. I have a problem when executing a with statement; e.g.
WITH x
AS (
SELECT level id
FROM dual
connect BY level <= 10
)
SELECT * FROM x
There are 0 rows returned for some strange reason.
I am using the ODBC driver & here is the code snippet.
myConnection = new OdbcConnection(ConStr);
myCommand = new OdbcCommand(SQL, myConnection);
myCommand.Connection.Open();
myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
for (int i = 0; i < myReader.FieldCount; i++)
{
listData.Columns.Add(myReader.GetName(i), 100, HorizontalAlignment.Center);
}
while (myReader.Read()) // reads rows
{
//if (!myReader.IsDBNull(0))
listData.Items.Add(myReader.GetValue(0).ToString());
for (int i = 1; i < myReader.FieldCount; i++) // reads columns
{
listData.Items[dispInd].SubItems.Add(myReader.GetValue(i).ToString());
}
Any comments/thought/help will be much appreciated. TIA, Joe