🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #2238

Re: VB-script niet in orde ?

#2238
From: Alain Cloet
Date: Thu, 19 Aug 2004 17:23
34 lines
2036 bytes
"Lucas" <luc.logghe@pandora.be> schreef in bericht
news:411c6fd7$0$294$ba620e4c@news.skynet.be...
> Het onderstaand VB-scriptje zet een prijskolom van een Excel file om naar
> dit formaat "00000000000.00"
> (via data-pump in MySQL)

> Function Main()
>  Euro = DTSSource("F4")
>  Zero="00000000000"
>  Val=CInt(Euro)

Zoals Trax meldde: Int (of CInt) rond af ... Mogelijkse workaround:

    Val=CInt(Euro-0.5)

>  Resu=Cstr(Val)
> ' Resu=Cstr(Euro)
>  Carac=Len(Resu)
>  Comma=Int((Euro-Int( Euro ))*100)
>  Nzer=11-Carac
>  if Comma  >9  then Pab=Mid(Zero,1,Nzer) & Mid(Resu,1,Carac) & "."&Comma
> else Pab=Mid(Zero,1,Nzer) & Mid(Resu,1,Carac) & "." & "0"&Comma
>  DTSDestination("TCAPAB") = Pab
>  Main = DTSTransformStat_OK
> End Function

Als 'format' hier bruikbaar is, kan het veel korter...(in VBA lukt het, maar
zelf heb ik geen ervaring met MySql)

Function Main()
    DTSDestination("TCAPAB")=Format( DTSSource("F4");"00000000000.00")
    Main = DTSTransformStat_OK
End Function
Technical Details
Message-ID: <O56Vc.4094$h5.5312573@iguano.antw.online.be>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!newsfeed.online.be!iguano.antw.online.be!not-for-mail
References: <411c6fd7$0$294$ba620e4c@news.skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Thread: fcea4,12cd16535135d789
X-Google-Attributes: gidfcea4,public
X-Google-Language: DUTCH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!newsfeed.online.be!iguano.antw.online.be!not-for-mail
From: "Alain Cloet" <iwantnospam@tijd.com>
Newsgroups: be.comp.programming
References: <411c6fd7$0$294$ba620e4c@news.skynet.be>
Subject: Re: VB-script niet in orde ?
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <O56Vc.4094$h5.5312573@iguano.antw.online.be>
Date: Thu, 19 Aug 2004 19:23:58 +0200
NNTP-Posting-Host: 62.112.10.212
X-Complaints-To: news-abuse@noc.online.be
X-Trace: iguano.antw.online.be 1092939246 62.112.10.212 (Thu, 19 Aug 2004 20:14:06 MET DST)
NNTP-Posting-Date: Thu, 19 Aug 2004 20:14:06 MET DST
Organization: Customer of TijdNet