/***************************/ /* Recupera singola Entità */ /***************************/ public void getDati() { clearDati(); tabellaLibri.Clear(); sql = "SELECT " + "AutoreLibro, TitoloLibro,CodGenereLibro, imgLibro, CodISBNLibro,AnnoPubLibro,InPrestitoLibro,ValLibro " + "FROM Libri " + "WHERE CodLibro = '" + _codice + "' "; try { tabellaLibri = sqlLibro.eseguiQuery(sql, CommandType.Text); _autore = tabellaLibri.Rows[0].ItemArray[0].ToString(); _titolo = tabellaLibri.Rows[0].ItemArray[1].ToString(); _codGenere = Convert.ToInt32(tabellaLibri.Rows[0].ItemArray[2]); _imgLibro = tabellaLibri.Rows[0].ItemArray[3].ToString(); _codISBN = tabellaLibri.Rows[0].ItemArray[4].ToString(); _anno = Convert.ToInt32(tabellaLibri.Rows[0].ItemArray[5]); _prestito = Convert.ToChar(tabellaLibri.Rows[0].ItemArray[6]); _val = Convert.ToChar(tabellaLibri.Rows[0].ItemArray[7]); } catch (Exception e) { _codice = -1; MessageBox.Show("Attenzione!!" + e.Message); } }
/***************************/ /* Recupera singola Entità */ /***************************/ public void getDati() { int I; clearDati(); tabellaUtenti.Clear(); sql = "SELECT " + "NominativoUtente, TipoUtente,UserIDUtente, PwdUtente, ValUtente" + "FROM Utenti " + "WHERE CodUtente = '" + _codice + "' "; try { tabellaUtenti = sqlUtente.eseguiQuery(sql, CommandType.Text); _nominativo = tabellaUtenti.Rows[0].ItemArray[0].ToString(); _tipo = tabellaUtenti.Rows[0].ItemArray[1].ToString(); _userID = tabellaUtenti.Rows[0].ItemArray[2].ToString(); _password = tabellaUtenti.Rows[0].ItemArray[3].ToString(); _val = Convert.ToChar(tabellaUtenti.Rows[0].ItemArray[4]); } catch (Exception e) { _codice = -1; MessageBox.Show("Attenzione !!" + e.Message); } }
/***************************/ /* Recupera singola Entità */ /***************************/ public void getDati() { int I; clearDati(); tabellaLettori.Clear(); sql = "SELECT " + "NomeLettore, CognomeLettore,MailLettore, NTesseraLettore, ValLettore " + "FROM Lettori " + "WHERE CodLettore = '" + _codice + "' "; try { tabellaLettori = sqlLettore.eseguiQuery(sql, CommandType.Text); _nome = tabellaLettori.Rows[0].ItemArray[0].ToString(); _cognome = tabellaLettori.Rows[0].ItemArray[1].ToString(); _mail = tabellaLettori.Rows[0].ItemArray[2].ToString(); _nTessera = tabellaLettori.Rows[0].ItemArray[3].ToString(); _val = Convert.ToChar(tabellaLettori.Rows[0].ItemArray[4]); } catch (Exception e) { _codice = -1; MessageBox.Show("Attenzione !!" + e.Message); } }
public void getPrestitoFromLibro() { string risultato = String.Empty; /* seleziona dalla tabella inquinanti tutti gli elementi con il nome passato e li conta */ sql = "SELECT *" + "FROM Prestiti " + "WHERE CodLibroPrestito = " + _codLibro + " AND DataResPrestito is NULL"; try { tabellaPrestiti = sqlPrestito.eseguiQuery(sql, CommandType.Text); _codLettore = Convert.ToInt32(tabellaPrestiti.Rows[0].ItemArray[1]); _codLibro = Convert.ToInt32(tabellaPrestiti.Rows[0].ItemArray[2]); _dataPrestito = Convert.ToDateTime(tabellaPrestiti.Rows[0].ItemArray[3]); //_dataRest = Convert.ToDateTime(tabellaPrestiti.Rows[0].ItemArray[4]); _val = Convert.ToChar(tabellaPrestiti.Rows[0].ItemArray[5]); } catch (Exception e) { MessageBox.Show("ATTENZIONE: " + e.Message); } }
/***************************/ /* Recupera singola Entità */ /***************************/ public void getDati() { int I; clearDati(); tabellaGeneri.Clear(); sql = "SELECT " + "NomeGenere, ValGenere " + "FROM Generi " + "WHERE CodGenere = '" + _codice + "' "; try { tabellaGeneri = sqlGenere.eseguiQuery(sql, CommandType.Text); _nome = tabellaGeneri.Rows[0].ItemArray[0].ToString(); _val = Convert.ToChar(tabellaGeneri.Rows[0].ItemArray[1]); } catch (Exception e) { _codice = -1; MessageBox.Show("Attenzione !!" + e.Message); } }