bob_payne
asked on
Oracle DataSet with multiple tables
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.Sele ctCommand = New OracleCommand
daLUT_PERSON_XSELFHID.Sele ctCommand. Connection = oConn
daLUT_PERSON_XSELFHID.Miss ingSchemaA ction = MissingSchemaAction.AddWit hKey
Dim otblLUT_PERSON_YINACTIVE As New DataTable
Dim daLUT_PERSON_YINACTIVE As New OracleDataAdapter
daLUT_PERSON_YINACTIVE.Sel ectCommand = New OracleCommand
daLUT_PERSON_YINACTIVE.Sel ectCommand .Connectio n = oConn
daLUT_PERSON_YINACTIVE.Mis singSchema Action = MissingSchemaAction.AddWit hKey
otblLUT_PERSON_YINACTIVE.T ableName = "LUT_PERSON_YINACTIVE"
oDataSet.Tables.Add(otblLU T_PERSON_Y INACTIVE)
otblLUT_PERSON_XSELFHID.Ta bleName = "LUT_PERSON_XSELFHID"
oDataSet.Tables.Add(otblLU T_PERSON_X SELFHID)
daLUT_PERSON_YINACTIVE.Sel ectCommand .CommandTe xt = "select * from UT_PERSON_YINACTIVE" & vbCrLf & "select * from LUT_PERSON_XSELFHID"
Try
daLUT_PERSON_YINACTIVE.Fil l(oDataSet )
Catch ex As Exception
Me.Log.Write(3, ex.ToString)
End Try
The following error happens on the 'Fill':
System.Data.OracleClient.O racleExcep tion: 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.O racleExcep tion: 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
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.Sele
daLUT_PERSON_XSELFHID.Sele
daLUT_PERSON_XSELFHID.Miss
Dim otblLUT_PERSON_YINACTIVE As New DataTable
Dim daLUT_PERSON_YINACTIVE As New OracleDataAdapter
daLUT_PERSON_YINACTIVE.Sel
daLUT_PERSON_YINACTIVE.Sel
daLUT_PERSON_YINACTIVE.Mis
otblLUT_PERSON_YINACTIVE.T
oDataSet.Tables.Add(otblLU
otblLUT_PERSON_XSELFHID.Ta
oDataSet.Tables.Add(otblLU
daLUT_PERSON_YINACTIVE.Sel
Try
daLUT_PERSON_YINACTIVE.Fil
Catch ex As Exception
Me.Log.Write(3, ex.ToString)
End Try
The following error happens on the 'Fill':
System.Data.OracleClient.O
If I put a semicolon at the end of the first select, I get this:
System.Data.OracleClient.O
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Maybe the vbCrLF is the problem, you do however need the semicolon
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.
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.
daLUT_PERSON_YINACTIVE.Sel
daLUT_PERSON_XSELFHID.Sele
Hope it helps
Navneet