Bilgiler > ExecuteScalar Örneği(MS SQL)
ExecuteScalar Örneği(MS SQL)
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[0].ConnectionString);
SqlCommand com = new SqlCommand();
com.CommandText = "select count(*) from dergi_yayin where dy_dergi_id=" + dg_id;
com.Connection = con;
con.Open();
int dergiyayinadet = (int)com.ExecuteScalar();
con.Close();
***