dbserver problem

Forum dedicato ai programmatori di X# in lingua italiana – Italian language forum

Moderator: wriedmann

Post Reply
ngpollarolo
Posts: 23
Joined: Mon Feb 29, 2016 3:51 pm
Location: Nicaragua

dbserver problem

Post 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 ?
User avatar
wriedmann
Posts: 4079
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: dbserver problem

Post by wriedmann »

Ciao,
per usare un DBServer hai bisogno di XSharp.RDD, VORDDClasses e VOSystemClasses.
Saluti
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ngpollarolo
Posts: 23
Joined: Mon Feb 29, 2016 3:51 pm
Location: Nicaragua

Re: dbserver problem

Post by ngpollarolo »

Grazie per la risposta.

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

Ho la versione pubblica di x#.
ngpollarolo
Posts: 23
Joined: Mon Feb 29, 2016 3:51 pm
Location: Nicaragua

Re: dbserver problem

Post 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.
User avatar
wriedmann
Posts: 4079
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: dbserver problem

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 5630
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: dbserver problem

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply