Paolo Mantovani wrote:
1. Fai la query per creare la tabella (esattamente come fai ora)
Esportare con Select INTO TEXT



Al momento ho utilizzato un metodo che funziona (ho fatto prove) ma e' al limite del ridicolo, praticamente quando faccio una Select per visualizzare i risultati in un Datagrid prendo la parte della Select FROM..WHERE e la metto in una variabile Stringa Globale per poi inniettarla nella SELECT INTO TEXT.

Seppur funziona la considero una vaccata, l' ideale sarebbe fare come nel primo post ho cercato di fare, ma facendo in un sol botto.

Ciao Jack



P.S. Non sono a conoscenza se e' lecito in ML mandare file in attach se cosi' non e' mi scuso in anticipo con tutti i partecipanti.




--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Vendi l'auto? La moto? La barca? Il Camper? Affitti un appartamento? * Per concludere i tuoi affari pubblica gli annunci con AdBoom.it! Facile. Veloce. Gratuito * Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7222&d=6-11
Global sSetRicette as String


Option Explicit

Sub Esporto
'______________________________________________________________________________________________________________________

Dim aUrl As New com.sun.star.util.URL   'aUrl array
Dim oUrlTransformer as Object, oBaseContext as Object, oDB as Object, oCon as 
Object, oStatement as Object
Dim oStatement1 as Object, oRS as Object
Dim sDoc as String, sQuery as String
'______________________________________________________________________________________________________________________

oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oDB = oBaseContext.getByName("MonsterChef")
oCon = oDB.getConnection("","")
oStatement = oCon.CreateStatement() 
oStatement1 = oCon.CreateStatement() 

oUrlTransformer = CreateUnoService("com.sun.star.util.URLTransformer")
sDoc = 
ThisComponent.DrawPage.Forms.getbyname("formRicette").ActiveConnection.Parent.DatabaseDocument.URL
aUrl.Complete = sDoc
oUrlTransformer.parseStrict(aUrl)

'________________________________________________________________________________

If Len(sSetRicette)<> 0 Then

  oStatement1.execute("DROP TABLE ""ricette"" IF EXISTS")

    If  FileExists(aUrl.Protocol & aUrl.Path & "/" & "ricette.csv" ) = True Then
      Kill aUrl.Protocol & aUrl.Path & "/" & "ricette.csv" 
    End If

    If FileExists(aUrl.Protocol & aUrl.Path & "/" & "ricette.dat" ) = True Then
      Kill aUrl.Protocol & aUrl.Path & "/" & "ricette.dat"
    End If

Else

 Msgbox "Non hai selezionato nessuna ricetta da esportare", 16, "Messaggio 
Utente"
 Exit Sub

End If     
'________________________________________________________________________________


sQuery = "SELECT ""tbricette"".""Dose"",  ""tbricette"".""TempoPreparazione"",  
""tbricette"".""Titolo"","&_
          "  ""tbricette"".""Ingredienti"",  ""tbricette"".""Preparazione"",  
""tbricette"".""Rating"","&_
           "  ""tbricette"".""Foto"",  ""tbricette"".""idRegione"",  
""tbricette"".""idCategoria"","&_
            "  ""tbricette"".""Favoriti"",  ""tbricette"".""idCuoco""  INTO 
TEXT ""ricette"" "&"  " & sSetRicette & " "
             
oRS = oStatement.executeQuery(sQuery)

  
Name aUrl.Protocol & aUrl.Path & "/" & "ricette.csv"  as  aUrl.Protocol & 
aUrl.Path & "/" & "ricette.dat"


oStatement1.execute("DROP TABLE ""prova"" IF EXISTS")
oCon.Close
    
End Sub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to