cm faccio ad aprire una connessione??
tipo questa:
string connectionString = System.Configuration.ConfigurationSettings.AppSett ings["CnnStr"].ToString();
SqlConnection cn = new SqlConnection(connectionString);
cn.Open();
string sql = "SELECT UserName,Password FROM AnagraficaUtenti WHERE UserName='qwerty' and Password='qwer000'";
DataTable dataTable = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
int recordsAffected = da.Fill(dataTable);
SqlCommand cmd = new SqlCommand(sql);
cmd.ExecuteNonQuery();
if (recordsAffected > 0)
{
}
cn.Close();
sl ke nn funz..
nel web.config ce qst cosice
<configuration>
<appSettings>
<add key="CnnStr" value="server=.\sqlexpress;uid=SA;pwd=BLACKBOX;dat abase=training"/>
</appSettings>
grazie![]()

