Aggiornare dei record di una tabella
<%@ Page language="c#" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<%@ Import Namespace="System.Data" %>
<script language="VB" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection cnn = new SqlConnection("server=DBSERVER;User id=USER;password=PASSWORD;database=DB");
SqlCommand UpdateCommand = new SqlCommand();
UpdateCommand.Connection = cnn;
string sql;
sql = "Update TABELLA Set CAMPO = 'VALORE' WHERE ID = ID";
UpdateCommand.CommandText = sql;
try
{
cnn.Open();
UpdateCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
response.Write(ex.ToString());
}
finally
{
cnn.Close();
}
}
</script>
Scarica il Codice...
Stampa la pagina