Article View: free.it.visual-basic
Article #404Re: Contare record su Vb
From: Rafunk
Date: Mon, 05 Jun 2006 13:14
Date: Mon, 05 Jun 2006 13:14
31 lines
2008 bytes
2008 bytes
Qwerty wrote:
> Devo contare i record di una tabella Access con Vb 6, ma non s� come
> farla stampare su una Text, il codice � questo, ma d� erorre, potete
> aiutarmi ??
>
> Grazie 100000 !
>
>
> Private Sub Form_Load()
> strconn = "provider=microsoft.jet.oledb.4.0;Data Source = " &
> App.Path & "\clienti.mdb"
> Set conn = CreateObject("ADODB.connection")
> conn.open strconn
>
> sql = "select count (corso) from corsi"
> Set rs = CreateObject("ADODB.recordset")
> rs.open sql, conn
> Text1.Text = rs("corso")
Nella query di conteggio, il campo calcolato ha un nome assegnato
automaticamente che non � "corso".
Devi quindi utilizzare un alias (AS...) nella query per assegnargliene uno a tuo
piacere:
sql = "select count (corso) AS conteggio from corsi"
...
Text1.Text = rs("conteggio")
Bye
Raf
Technical Details
Message-ID:
<e61an8$jih$1@alix.livenet.it>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!nntp.infostrada.it!alix.livenet.it!not-for-mailReferences:
<eBVgg.24828$cX1.390091@twister2.libero.it>Show Full Headers
Complete Article Headers
X-Google-Thread: f94ee,511f60b5208deec3 X-Google-Thread: 10b997,511f60b5208deec3 X-Google-Attributes: gidf94ee,gid10b997,public X-Google-Language: ITALIAN,CP1252 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!nntp.infostrada.it!alix.livenet.it!not-for-mail From: "Rafunk" <rafunkSPAM@NOTHANKSlibero.it> Newsgroups: free.it.visual-basic,it.comp.lang.visual-basic Subject: Re: Contare record su Vb Date: Mon, 5 Jun 2006 15:14:17 +0200 Organization: MusicOff S.r.l. Lines: 33 Sender: rafunk@musicoff.com Message-ID: <e61an8$jih$1@alix.livenet.it> References: <eBVgg.24828$cX1.390091@twister2.libero.it> NNTP-Posting-Host: host150-196.pool8250.interbusiness.it Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8bit X-Trace: alix.livenet.it 1149513256 20049 82.50.196.150 (5 Jun 2006 13:14:16 GMT) X-Complaints-To: abuse@musicoff.com NNTP-Posting-Date: Mon, 5 Jun 2006 13:14:16 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441