Pedro Hernández (12/04/2008)
Sorry it works, the problem is when I save usisng the save method bo.save()Pedro,
Probably there are some methods in SF which will use the TableSchema property of the BO, and in your code you are not updating this property, then it will return the schema of the table which was selected at the time of the BO generation by the BOM.
Like I said before, in your base BO class, simply override that property to return the value of your custom schema, something like this:
Public
Overridable ReadOnly Property TableSchema() Get Return GetCustomSchemaName() End GetEnd PropertyPrivate Function GetCustomSchemaName() As String '-- Add your logic here to return your Schema Name from your source. Return "Your Schema Name"End Function
Or if you want to make is simpler, don't create the GetCustomSchemaName() function and add that logic in the "Get" of the TableSchema property. If you don't have a base BO, then you will need to do the same for all the BO you create, so it is a best practice to have your own base BO class.
And in your Fill command try to use the propertys of the BO available to you like the TableSchema, so your method may look like this:
Public Sub FillAll() Me.FillDataTable("SELECT * FROM " & Me.TableSchema & ".OP_OPER_DET_MO WHERE ORDEN_PRODUCCION IN " & _" (SELECT ORDEN_PRODUCCION FROM " & Me.TableSchema & ".ORDEN_PRODUCCION WHERE ESTADO='L' ) AND OPERACION = 'GALERA' ORDER BY ORDEN_PRODUCCION")End Sub
Of course, I have not try the above, it is mean to give you an idea to explore.
Edhy Rijo