xsharp.eu • dbserver problem
Page 1 of 1

dbserver problem

Posted: Fri Apr 25, 2025 5:44 pm
by ngpollarolo
Devo creare una applicazione di tipo console che deve leggere un .dbf. Nelle Referenze tengo Xsharp.core, xsharp.vo e xsharp.rt. Quando compilo mi da il seguente errore: error XS0246: The type or namespace name 'DbServer' could not be found (are you missing a using directive or an assembly reference?) 15,7 Start.prg Start.

Il linguaggio e' Xsharp e il dialetto e' VO.

USING System
USING System.IO
USING System.Net
USING System.Net.Mail
USING XSharp

FUNCTION Start( ) AS VOID

LOCAL cMens AS STRING
LOCAL logFile := "D:\Nunez.3\enviaCorreo\reporte_cartera_log.txt"
LOCAL mensaje AS MailMessage
LOCAL Smtp AS SmtpClient
LOCAL rutaExcel:="D:\Nunez.3\enviaCorreo\"

LOCAL oCob AS DbServer

oCob:=DBServer{'d:\nunez.3\datos24\faacob.dbf',.t.,.t.}
IF !oCob:used
cMens:='No Puedo Abrir FAACOB - Facturas en Cartera'
File.AppendAllText(logFile, DateTime.Now:ToString() + " ? " + cMens + CRLF)
RETURN
ENDIF

Che sto facendo male ?

Re: dbserver problem

Posted: Fri Apr 25, 2025 6:44 pm
by wriedmann
Ciao,
per usare un DBServer hai bisogno di XSharp.RDD, VORDDClasses e VOSystemClasses.
Saluti
Wolfgang

Re: dbserver problem

Posted: Fri Apr 25, 2025 7:41 pm
by ngpollarolo
Grazie per la risposta.

Ho aggiunto XSharp.Rdd pero' mi da lo stesso errore.

Ho la versione pubblica di x#.

Re: dbserver problem

Posted: Fri Apr 25, 2025 7:47 pm
by ngpollarolo
Scusa, mi sono sbagliato.

Aggiungendo le referenze mi da questo errore quando voglio recuperare i valori dei campi del dbf:

warning XS9094: Type 'VO.DbServer' does not have a member 'cod_cli'. This gets resolved to a late bound call to its method 'NoIVarPut'. 26,1 LeeCob.prg LeeCob

cod_cli e' un campo.

Re: dbserver problem

Posted: Sat Apr 26, 2025 8:26 am
by wriedmann
Ciao,
questo era così anche con VO.
Ma comunque è solo un warning che puoi sopprimere aggiungendo
/nowarn:9094
tra le opzioni di compilazione del programma.
Magari Chris ha un'altra possibilità.
Saluti
Wolfgang

Re: dbserver problem

Posted: Sat Apr 26, 2025 3:35 pm
by Chris
Guys,

It's as Wolfgang says, the compiler does not know if you intend to use a field of the DBServer, or an object member that does not exist (wrong spelling), so it gives a warning. All related warnings can be disabled for the whole project, or locally, only for the .prg or entities of the prg that use such code with a pragma:

#pragma warning (9094, off) // disable warning locally
// code that uses fields of DBServer
// ...
// ...
#pragma warning (9094, default) // set warning reported to default value (on/off)

Btw, Giorgio, one thing that might not be obvious, is that this is only a warning reported by the compiler, not an error. It is shown as an error only because you have the option "warnings as errors" enabled in your project settings.