scusate, sar io ma non riesco a fare questa cosa:
devo aggiornare l’esistenza degli articoli quando vado a confermare un ordine (web)
quindi ho fatto un ciclo in questo modo:
If db.Connect Then
// AGGIORNIAMO LA QUANTITA' NELLE GIACENZE
Dim ps As MSSQLSERVERPreparedStatement
Dim rs As RecordSet
Dim stringa_sql as string
stringa_sql = "select ordinicd.CodArt, ordinicd.Lotto, ordinicd.QtaOrd, lottiart.Esistenza from ordinicd left outer join lottiart on ordinicd.Codart=Lottiart.codart and ordinicd.lotto=lottiart.lotto "_
+" where IdOrd = ? and lottiart.siglacli=? order by ordinicd.NumRiga"
ps = db.Prepare(stringa_sql)
ps.BindType(0, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
ps.BindType(1, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
ps.Bind(0, ordine.OrdineSel)
ps.Bind(1, Login_Page.TxtSiglaCli.Text)
rs = ps.SQLSelect
'break
if rs <> Nil Then
dim differenza as Integer
While Not rs.EOF
differenza=rs.IdxField(4).IntegerValue-rs.IdxField(3).IntegerValue
stringa_sql="update lottiart set Esistenza="+differenza.ToText+" where SiglaCli='"+Login_Page.TxtSiglaCli.Text+"' and CodArt='"+rs.IdxField(1).StringValue+"' and Lotto='"+ rs.IdxField(2).StringValue+"' "
'Break
ps=db.Prepare(stringa_sql)
ps.SQLExecute
Wend
rs.Close
end if
// MEMORIZZIAMO IL RIFERIMENTO AL DDT NEL DATABASE
creanumeroddt
// CREAZIONE FILE TXT
creafiletxt
.......
tralasciando l’uso di prepared statement (nella update non l’ho ancora utilizzato per vedere in break come mi costruisce realmente la stringa dell’istruzione sql (ed corretta), il problema che rimane bloccato, la update la fa, nel db il dato aggiornato, ma come se non esce dal ciclo…
dove sbaglio???