lanciare dialog da dialog

buongiorno a tutti,

ho una webapp con una webpage (elenco fatture) che lancia (tramite doppio click su listbox) una dialog con il dettaglio fattura.
su questa dialog ho dei pulsanti, per uno di essi (“elimina fattura”) vorrei aprire una dialog con una conferma.

se lo faccio a partire da una webpage tutto ok, se lo faccio dalla dialog ottengo un errore, in pratica questo quello che viene lanciato nel pulsante “Si” del dialog di conferma (dettaglio_fattura il dialog che lancia la conferma)

Dim db As New MSSQLServerDatabase
db.Host =ATIWeb.host // or just the IP if using the default instance
db.DatabaseName = ATIWeb.dbnm
db.UserName = ATIWeb.user  // or "Domain\\UserID for trusted domain accounts
db.Password = ATIWeb.pass

If db.Connect Then
  //inseriamo i dati nel db
  Dim ps As MSSQLServerPreparedStatement
  dim stringaSQL,mese,tipofatt as string
  
  Dim i,numriga as Integer
  numriga = 0
  
  //mettiamo il mese come numero
  if Dettaglio_Fattura.TxtMese.text = "Gennaio" then
    mese = "01"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Febbraio" then
    mese = "02"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Marzo" then
    mese = "03"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Aprile" then
    mese = "04"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Maggio" then
    mese = "05"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Giugno" then
    mese = "06"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Luglio"then
    mese = "07"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Agosto" then
    mese = "08"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Settembre" then
    mese = "09"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Ottobre" then
    mese = "10"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Novembre" then
    mese = "11"
  end if
  if Dettaglio_Fattura.TxtMese.text = "Dicembre" then
    mese = "12"
  end if
  
  if Dettaglio_Fattura.TxtTipoFatt.Text = "Acconto" then
    tipofatt = "A"
  else
    tipofatt = "S"
  end if
  
  //prima cancelliamo le righe presenti
  stringaSQL="DELETE FROM ABFATTURE_DETT WHERE ABANNO='"+Dettaglio_Fattura.TxtAnno.Text+"' AND ABMESE='"+mese+"' AND ABCODFOR='"+Dettaglio_Fattura.TxtCodFor.text+"' AND ABCODCEN='"+Dettaglio_Fattura.TxtCodice.text+"' AND ABTIPOFATT='"+tipofatt+"'"
  ps = db.Prepare(stringaSQL)
  ps.SQLExecute
  
  For i = 0 to Dettaglio_Fattura.LstRigheFattura.LastIndex
    numriga = numriga + 1
    
    //adesso inseriamo i valori della griglia
    stringaSQL="INSERT INTO ABFATTURE_DETT (ABANNO,ABMESE,ABCODFOR,ABCODCEN,ABTIPOFATT,ABNUMRIGA,ABCODART,ABTIPART,ABQTAART,ABPREZZO,ABVALRIGA,ABCODIVA,ABPERIVA) "_
    +"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"
    
    ps = db.Prepare(stringaSQL)
    
    ps.BindType(0, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(1, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(2, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(3, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(4, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(5, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_INT)
    ps.BindType(6, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(7, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(8, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_INT)
    ps.BindType(9, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_DOUBLE)
    ps.BindType(10, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_DOUBLE)
    ps.BindType(11, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
    ps.BindType(12, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_DOUBLE)
    
    ps.Bind(0, Dettaglio_Fattura.TxtAnno.Text)
    ps.Bind(1, mese)
    ps.Bind(2, Dettaglio_Fattura.TxtCodFor.text)
    ps.Bind(3, Dettaglio_Fattura.TxtCodice.text)
    ps.Bind(4, tipofatt)
    ps.Bind(5, numriga)
    ps.Bind(6, Dettaglio_Fattura.LstRigheFattura.Cell(i,0))
    ps.Bind(7, "T")
    ps.Bind(8, Dettaglio_Fattura.LstRigheFattura.Cell(i,2).Val)
    ps.Bind(9, Dettaglio_Fattura.LstRigheFattura.Cell(i,3).Val)
    ps.Bind(10, Dettaglio_Fattura.LstRigheFattura.Cell(i,4).Val)
    ps.Bind(11, Dettaglio_Fattura.LstRigheFattura.Cell(i,5))
    ps.Bind(12, Dettaglio_Fattura.LstRigheFattura.Cell(i,6).Val)
    
    
    ps.SQLExecute
  next
  //dobbiamo adesso aggiornare lo stato della testata
  stringaSQL="UPDATE ABFATTURE_MAST SET ABSTATO='C' WHERE ABANNO='"+Dettaglio_Fattura.TxtAnno.Text+"' AND ABMESE='"+mese+"' AND ABCODFOR='"+Dettaglio_Fattura.TxtCodFor.text+"' AND ABCODCEN='"+Dettaglio_Fattura.TxtCodice.text+"' AND ABTIPOFATT='"+tipofatt+"'"
  ps = db.Prepare(stringaSQL)
  ps.SQLExecute
  'msgbox(stringaSQL)
Else
  MsgBox("Connection error:" + db.ErrorMessage)
End If
//azzeriamo la quantit
Dettaglio_Fattura.TxtQta.Text="0"
self.Close
//aggiorniamo la visualizzazione
Fatturazione.CaricaFatture

e questo l’errore:

this item does not exist
if Dettaglio_Fattura.TxtMese.text = “Gennaio” then

e cosi via, nonostante il meccanismo di autocompletamento del codice mi permetta di selezionare tale campo…

mi date un aiutino???

grz ciro

A parte, se mi permetti, il curioso uso dei prepared statement con l’sql costruito a mano, perdendo tutto il vantaggio del loro utilizzo, ma immagino che sia per debug…

Venendo alla tua domanda, probabilmente Dettaglio_Fattura è la finestra o un componente della finestra.
Nella web dialog o non c’è o non è istanziata (presente realmente sulla pagina)
Al limite potresti passarlo come parametro alla web dialog (come oggetto da render nil, weak ref, etc)
Altrimenti dovresti dare più informazioni sull’errore

allora, si hai ragione ma spesso faccio copia/incolla di istruzioni sql, prima o poi le ripasser con il bindtype, ecc…
su quelle fatte da zero per lo uso! :slight_smile:

allora, provo a schematizzara cosi

dettaglio_fattura (dialog) >> chiama >> dialog_conferma

su dettaglio_fattura ho trascinato con il drag and drop la dialog_conferma (la vedo in basso con il simbolo rotellina come dialog_conferma1)
come instanza dovrebbe essere ok, quello che voglio fare questo

pulsante salva su dettaglio_fattura
inizia procedura di conferma (update ed insert varie sul db)
richiesta conferma (la dialog che vorrei aprire con i pulsanti si/no)
se cliccato si, vai avanti, altrimenti stop

c