Solved

Oracle DataSet with multiple tables

Posted on 2004-04-22
4
1,462 Views
Last Modified: 2010-05-18
I have to do some major changes to an Oracle database; adding rows that require constraints to other tables.  Therefore I need the other tables in my dataset.

I can't get multiple resultsets to work.

Here's the code:


Dim otblPerson As New DataTable
Dim oDataRow As DataRow
Dim oDataSet As New DataSet("Pathlore")
Dim otblLUT_PERSON_XSELFHID As New DataTable
Dim daLUT_PERSON_XSELFHID As New OracleDataAdapter

daLUT_PERSON_XSELFHID.SelectCommand = New OracleCommand
daLUT_PERSON_XSELFHID.SelectCommand.Connection = oConn
daLUT_PERSON_XSELFHID.MissingSchemaAction = MissingSchemaAction.AddWithKey

Dim otblLUT_PERSON_YINACTIVE As New DataTable
Dim daLUT_PERSON_YINACTIVE As New OracleDataAdapter
daLUT_PERSON_YINACTIVE.SelectCommand = New OracleCommand
daLUT_PERSON_YINACTIVE.SelectCommand.Connection = oConn
daLUT_PERSON_YINACTIVE.MissingSchemaAction = MissingSchemaAction.AddWithKey

otblLUT_PERSON_YINACTIVE.TableName = "LUT_PERSON_YINACTIVE"
oDataSet.Tables.Add(otblLUT_PERSON_YINACTIVE)
otblLUT_PERSON_XSELFHID.TableName = "LUT_PERSON_XSELFHID"
oDataSet.Tables.Add(otblLUT_PERSON_XSELFHID)

daLUT_PERSON_YINACTIVE.SelectCommand.CommandText = "select * from UT_PERSON_YINACTIVE" & vbCrLf & "select * from LUT_PERSON_XSELFHID"

Try
daLUT_PERSON_YINACTIVE.Fill(oDataSet)
Catch ex As Exception
Me.Log.Write(3, ex.ToString)
End Try

The following error happens on the 'Fill':
System.Data.OracleClient.OracleException: ORA-00933: SQL command not properly ended

If I put a semicolon at the end of the first select, I get this:
System.Data.OracleClient.OracleException: ORA-00911: invalid character

If I separate them into two DataAdapters with two separate 'Fill's into the same DataSet, it tells me I tried to create duplicate data.  I think it is trying to fill the first table twice.

I'm programming in VB.NET with an Oracle connection.  I cannot use stored procedures.

Thanks in advance for any guidance you can give me.

Bob Payne
0
Comment
Question by:bob_payne
4 Comments
 
LVL 2

Expert Comment

by:navneet77
ID: 10889146
Can you try

daLUT_PERSON_YINACTIVE.SelectCommand.CommandText = "select * from UT_PERSON_YINACTIVE"

daLUT_PERSON_XSELFHID.SelectCommand.CommandText = "select * from LUT_PERSON_XSELFHID"

Hope it helps

Navneet
0
 
LVL 5

Accepted Solution

by:
tgannetts earned 250 total points
ID: 10889209
As far as I am aware, multiple resultsets are only supported in SQL Server, not Oracle, which is why the Command Not Properly Ended errors are being generated.

If you separate the DataAdapters, it is best to use the Fill command with the Tables in the Dataset specified, so:

Try
     daLUT_PERSON_YINACTIVE.Fill(oDataset.tables("LUT_PERSON_YINACTIVE"))
     daLUT_PERSON_XSELFHID.Fill(oDataset.tables("LUT_PERSON_XSELFHID"))
catch ex as exception
End try

Tom
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 10889237
Maybe the vbCrLF is the problem, you do however need the semicolon
0
 
LVL 1

Expert Comment

by:siobi
ID: 10956254
r u guys facing below problem?
Dear,
I'm using Microsoft Visual Studio .Net Pro 2003.

I'm using VB.net do develop an simple database application.

The database that I'm using currently is Oracle 8i.

The application having 2 Buttons, hereby call Button A and Button B.

The application start and when I press Button A, it loads the data from the oracle database using "Microsoft .NET Framework Data Provider for Oracle"

but it shows lacking and I want to stress more about it is I only having 10 records in my database!!!

when the data is loaded. I press the Button A again and everything seems goes fine, the data loading speed turns fine.

same thing applies for the button B.

So I'm wondering, last time when I'm using VB6.0, there is no such problem(lacking problem), but why it is lacking for VB.NET and it is always the first time I load the data?

I had try the same thing again on VB6.0 on the same machine same connection to DB, and it works fine.

my Boss is unhappy with this situition and I'm here looking for reply URGENTLY.

thanks for the help and sorry about my poor english.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Multiple file Upload asp.net 2 49
Opening and Closing Connections and Data Adapters 10 49
SQL syntax in VB.net 5 39
How to open form using item in Listbox. 8 21
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question