Sei sulla pagina 1di 1

protected void btn_salva_Click(object sender, EventArgs e)

{
//Routine di controllo degli input
//ADO.NET per l'inserimento
SqlConnection cn = new
SqlConnection(ConfigurationManager.ConnectionStrings["BibliotecaScalabriniConnectio
nString"].ToString());
string command = String.Format("INSERT INTO BibliotecaScalabrini VALUES
('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','
{13}','{14}','{15}','{16}','{17}')",txt_collocazione.Text,txt_liste.Text,txt_autore
.Text,txt_editoriale.Text,
txt_titolo.Text,txt_publica.Text,txt_rivig.Text,txt_rivip.Text,txt_descrizione_fisi
ca.Text, txt_campo17.Text, txt_campo_18.Text, txt_campo_19.Text,txt_soggetto.Text,
txt_note_generali.Text, txt_data_pubblicazione.Text, txt_data_23.Text,
txt_data_24.Text, txt_data_25.Text);

SqlCommand cmd = new SqlCommand(command, cn);


try
{
cn.Open();
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{

throw new ArgumentException(ex.Message);


}
finally
{
cn.Close();
}
}

Potrebbero piacerti anche