VS2010 Convert datasets to ODP.net - visual-studio-2010

We have a solution in VS2010. In some projects we have a dataset. All datasets contains more then 1 DataTables and tableAdapters.
The solution was developed using SYSTEM.DATA.ORACLECLIENT.
Now we want to convert to ODP.net and we have to use ORACLE.DATAACCESS.CLIENT.
We did on forums how to do this.
So we have already done :
- References "SYSTEM.DATA.ORACLECLIENT" on project levels are removed.
- References "ORACLE.DATAACCESS" are added.
- All "Using SYSTEM.DATA.ORACLECLIENT;" are changed into "using Oracle.DataAccess.Client;"
- In some connectionstrings we removed "Unicode=true"
- We did NOT do anything yet with adding BindingName = true in the OracleCommand
- We did NOT do anything yet with changing dbtypes like VarChar, VarNumeric, ...
I get no build errors but when running the solution I get an error about "Value does not fall within the expected range".
Now I have the feeling that my datasets are not 100% converted to ODP.net.
So I need some help.
How to check or indeed convert datasets to OPD.net (Oracle.DataAccess.Client) ?
What about properties like "Hierarchical Update", "DeleteDBDirectMethods", ...
A dataset is represented by 4 files : .cs, Designer.cs, .xsc and .xss.
The code in these file seems ok : I mean I see Oracle.DataAccess.Client.
Who can help me ?

We came across this issue too after converting our Data Sets (XSD's) from using System.Data.OracleClient to Oracle.DataAccess.Client.
The issue was that the Data Set designer was still using "Number" as the data type for the ProviderType. Oracle does not support the "Number" data type. We had to change the ProviderType in each of our Data Sets for each Table Adapter and each collection of Parameters for every query in the Table Adapter. We used "Decimal" for the ProviderType, and it seems to work fine. Don't forget to check the auto-generated "Select", "Update", and "Delete" queries too.
We haven't changed the BindByName = true either.
Hopefully this will help.

I followed the advice given in this post on the Oracle forums:
I was trying to convert from using the System.Data.OracleClient adapter to use ODP.NET so I just went directly into the dataset xsd and changed the provider to point to Oracle.DataAccess.Client and it regenerated the code with the correct provider.
This worked for me - open the XSD using the XML (Text) editor, then find this line:
<Connection ... Provider="System.Data.OracleClient">
Change it to this:
<Connection ... Provider="Oracle.ManagedDataAccess.Client">
When you rebuild, all code in the .Designer.cs file will be updated to use Oracle.ManagedDataAccess.

Related

MSDatashape being deprecated

In the following microsoft documentation: -
https://learn.microsoft.com/en-us/sql/ado/guide/appendixes/microsoft-data-shaping-service-for-ole-db-ado-service-provider?view=sql-server-2017
this feature is being removed and the suggestion is to use XML. Has anyone done this? I'm wondering what they mean, in terms of loading the structure of what MSDataShape is by using XML, or just to use XML objects?
TIA
I believe this is referring to the FOR XML clause of T-SQL, which performs much the same job as MSDataShape in that it returns hierarchically nested data.
Port your MSDataShape queries to FOR XML queries and change the client to parse the results instead of using the MSDataShape OLEDB provider.
At the client side, SAX or pull parsing would be the best fit to port code that previously used MSDataShape (which also had a move-through-the-records cursor based model).
This is my bit of code that is helpful. My MSDataShape code still works, therefore I propose using that to generate your XML as a template, then use that going forward to load them: -
Dim objShapeMaker As clsShapeMaker
Dim rsoTemp As ADODB.Recordset
Dim strXMLTemplate As String
' Template file
strXMLTemplate = "C:\Temp\Template_GI.xml"
' Create the MSDataShape and save it to XML
Set rsoTemp = objShapeMaker.CreateGI()
rsoTemp.Save strXMLTemplate, adPersistXML
' Now we have the XML in a file going forward, load it in my recordset
Set rsoTemp = New ADODB.Recordset
rsoTemp.Open strXMLTemplate, , , , adCmdFile
' Cleanup
Set rsoTemp = Nothing
Set objShapeMaker = Nothing
If you don't like the idea of generating XML template files to maintain, you could do this via .NET and expose it to COM to use in your VB6/VBA application as mentioned here.
I have made a .NET application that can generate these XML files from simple code lines should anyone want going forward that is similar to the blog listed, however it handles child recordsets with relationships.
EDIT 1: This works great if you have schema set ups without returning data. As far as I can tell, to populate these effectively, it's better to write code to load the structure first, and populate it after from seperate recordsets (which is slower!)
EDIT 2: This is the approach we are taking with a replacement in a .NET Interop. Initially looking at bringing XML from SQL and parsing that back as required. This could be bought back into a DataSet and that's parsed into the target recordset as well, but then the relationship between the tables in the result dataset needs to be set in code rather than the one place in T-SQL with XML output.

odoo-8 Template 'report.layout' not found

I can't print no reports anymore with odoo 8.
As it seems, the error is in the database because a newly created database doesn't have this problem.
But how can I correct this in the current database?
File "/opt/odoo8/server/openerp/addons/base/ir/ir_qweb.py", line 200, in get_template
raise QWebTemplateNotFound("Template %r not found" % name, template=origin_template)
QWebTemplateNotFound: Template 'report.layout' not found
Thanks for helping...
You probably have mistakenly butchered either web.layout or report.layout records. In your database that works. Go to Settings -> User Interface -> Views and search for layout. Select report.layout and make note of the configuration and values. Export it or copy it to your broken database. Your broken database may be missing this record entirely. This is a base view so unless you have modified it a vanilla record should work. The important part is the external id as without it you will probable still get this error.

Adding a range on an enum field

I am trying to add a range (which I believe functions as a filter, right?) on an Enum field. This data source table is used in a Web Report.
This is what I do in the init method of the Web Report:
this.query().dataSourceTable(tablenum(SupplProduct)).addRange(fieldnum(SupplProduct, ShowOnReport)).value(QueryValue(NoYesCombo::Yes));
ShowOnReport is a field of type NoYesCombo Enum.
The Web Report crashes with this error:
Invalid range
I've managed to find quite a few examples on the web and this seems to be the proper way to do it so it supports all languages.
Any ideas ?
Could it be the properties of the field I'm trying to add a range on ?
Right underneath the line of code above, there is another similar line doing exactly the same, on another field:
//this is at the beginning of the init method...
AppointmentTable activeAppoint = element.args().record().data();
;
this.query().dataSourceTable(tablenum(AppointmentTable)).addRange(fieldnum(AppointmentTable, AppointmentId)).value(queryValue(activeAppoint.AppointmentId));
This range works fine.
Thanks.
Oh crap. The Enterprise Portal server and its Business Connector was still at version RTM while the AOS server it connects on is RU8. After I patched the EP server to RU8, this works.
Thanks.

Validate against schema fragment

I'm new to json-schema so it might not be a relevant issue.
I'm using https://github.com/hoxworth/json-schema.
I have one big json file describing a lot of schemas (mostly small ones) with a lot $ref between schemas, and I need to be able to validate data against one of these "inner" schemas. I can't find a way to do this with json-schema.
Does json-schema support this use case, or am I doing it wrong ?
It appears it does. It states that it uses the json schema v4. Also in the source code: line 265 lib/json-schema/validator.rb.
def build_schemas(parent_schema)
# Build ref schemas if they exist
if parent_schema.schema["$ref"]
load_ref_schema(parent_schema, parent_schema.schema["$ref"])
end

vb.net data set not working

I am using two different datasets to populate datagridview my project using visual studio using vb.net. It is windows forms application which is used to display information from the database based on user inputs. Once the information is displayed the user can save the information into a table specifically created to store the report information in order for it to be recalled at a later date. I am now trying to recall this information so have created my dataset in the same way as before and am now trying to invoke a new occurrence of it and this is where the probelm begins. The code is below.
Dim dv2 As New System.Data.DataView
dv2 = New System.Data.DataView(DataSet2.Tables(0), "Status <> ''", "",
DataViewRowState.CurrentRows)
DataTable2TableAdapter.fill(DataSet2.DataTable2, f5.ComboBox2.SelectedValue)
I am getting two issues.
For DataSet2.Tables(0): Reference to a non-shared member requires an object reference
For DataTable2TableAdapter: ’DataTable2TableAdapter’ is not declared. It may be inaccessible due to its protection level.
I dont know why this is happening as I have written the same code here as for my previous data set other than changing the SQL statement behind the dataset at set up. Any thoughts would be welcome as I am totally out of ideas. All questions are welcomed.
Thanks
Try the following code to fix your error number 1....
Dim tablezero as System.Data.DataTable
'
tablezero = DataSet2.Tables(0)
The reason your getting the error is because you are trying to access an object (Table(0)) and it is not visible to the code that is trying to access it, if it was SHARED then it would be visible.
So you can resolve it by defining and object instance/reference to it and then accessing that reference, which in this case i have called "tablezero" (or by making table(0) SHARED - usually not the best bet unlessits neccesary - no point in having something accessible to the whole class it is declared in unless absolutelty neccessary)
It is quite possible the second error may dissapear after just fixing above, then again its difficult to tell without your code for Dataset2
Hope it helps.

Resources