This is a viewer only at the moment see the article on how this works.
To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk
This is a preview from the server running through my markdig pipeline
Semplice schema per il blocco Data Access Application
Friday, 08 September 2006
Semplice schema per il blocco Data Access Application
pubblicato il Venerdì, 27 agosto 2004 13:38
Pensavo di buttare un semplice esempio di codice per il modello (molto) semplice che uso quando scrivo il codice di accesso ai dati con il Blocco applicazione accesso dati. Questo esempio è per fare un semplice inserto di oggetto (non transazionale) in un DB:
vuoto statico interno AddEmailAddressToContact(Int64 contactId, EmailAddress emAddr)
{
stringa spName = "pr_MedSh_AggiungiEmailIndirizzoContatto";
SqlParameterCity name (optional, probably does not need a translation)[] sqlParams = SqlHelperParameterCache.GetSpParameterSet(Global.Config.DBConnectionString,spName);
sqlParamsCity name (optional, probably does not need a translation)[0].Value = contactId;
sqlParamsCity name (optional, probably does not need a translation)[1].Value = emAddr.IndirizzoTipoId;
sqlParamsCity name (optional, probably does not need a translation)[2].Value = emAddr.IsPrimary;
sqlParamsCity name (optional, probably does not need a translation)[3].Value = eddr.Indirizzo;
SqlHelper.EseguiNonQuery(Global.Config.DBConnectionString,CommandType.StoredProcedure,spName,sqlParams);
}
Te l'ho detto che era semplice! Questo è il modello che uso per tutte queste cose. Usando un SqlDataReader è altrettanto facile, avvolgo il 'SqlDataReader dr = SqlHelper.ExecuteReader' in un blocco 'usando' e lo passo molto indietro tra i livelli, preferendo invece utilizzare semplici collezioni personalizzate o ArrayLists.