codice:
	<%@language=javascript%>
<%
pdf=new FPDF();
var fatture=new Array();
var data_fatt = new Date();
var i_fatt=-1;
CARICO L'ARRAY CON LE FATTURE 
var cn = new ActiveXObject("ADODB.Connection");
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:/Inetpub/wwwroot/mipson/public/mdb-database/db.mdb;Persist Security Info=False";
cn.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
var SQL = "select n_fatt from STAMPA_FATTURE";
rs.Open(SQL, cn);
	   
while(!rs.eof) {
	i_fatt++;
	fatture[i_fatt]=(rs(0));
rs.MoveNext();
}
	
rs.Close();
cn.Close(); 
SCRIVO L'INTESTAZIONE DEL PDF, PERO QUANDO FACCIO IL CICLO L'ARRAY è VUOTO 
IN QUESTO ESEMPIO HO TOLTO IL CICLO FOR E MESSO COME INDICE DELL'ARRAY 0 PERCHE COSI SONO SICURO CHE IL PRIMO ELEMENTO L'HO SCRITTO IN PRECEDENZA 
// Ridefinizione delle funzioni
pdf.Header=function Header()
{
	var data_fatt = new Date();
	var cn = new ActiveXObject("ADODB.Connection");
	var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:/Inetpub/wwwroot/cliente/public/mdb-database/db.mdb;Persist Security Info=False";
	cn.Open(strConn);
	var rs = new ActiveXObject("ADODB.Recordset");
	var SQL = "select format(data,'dd/mm/yyyy'), nome, cognome, rag_soc from FATTURE WHERE id_fattura="+fatture[0]+"";
	rs.Open(SQL, cn);
	   
	while(!rs.eof) {
		data_fatt=(rs(0));
		
		nome=(rs(1));
		cognome=(rs(2));
		rag_soc=(rs(3));
		//SCRIVO L'INTESTAZIONE NEL PDF
		this.Image('images/header.JPG',115,8,80);
		this.Line(10,15,200,15);
		
		
		this.SetX(10);
		this.SetY(40);
		
		//FATTURAZIONE
		this.SetFont('Arial','I',12);
		this.Cell(100,4,'Indirizzo di Fatturazione:',0,0,'L');
		
		this.SetX(-100);
		this.Cell(100,4,'Indirizzo di Spedizione:',0,1,'L');
		
		this.SetFont('Arial','B',12);
		this.Cell(30,10,'Spett.le',0,0,'L');
		
		this.SetX(-100);
		this.Cell(30,10,'Spett.le',0,1,'L');
		
		this.SetFont('Arial','',12);
		
		if (rag_soc!="")
		{
			this.Cell(100,4,rag_soc,0,0,'L');
		}
		
		this.SetX(-100);
		this.Cell(100,4,presso_spe,0,1,'L');
		
		if (cognome!="")
		{
			this.Cell(100,4,(cognome + " " + nome),0,1,'L');
		}
		
		
		
		this.Ln(12);
		
		this.SetLineWidth(0.7);
		this.Line(10,75,200,75);
		this.SetLineWidth(0);
		
		
		
		
	
		rs.MoveNext();
	}
	
	rs.Close();
	cn.Close(); 
	
}
 
Percio ho due soluzione o capire come mai la variabile si svuota dopo che ho finito While dqlla prima query, oppure leggere i valori dalla text...