Example #1
0
 protected void btnSend_Click(object sender, EventArgs e)
 {
     Author a = new Author();
     a.authorName = txtAuthorName.Text;
     a.addAuthor();
     Response.Redirect("~/default.aspx");
 }
Example #2
0
 public static List<Author> getAuthors()
 {
     List<Author> authors = new List<Author>();
     MySqlConnection cnn = new MySqlConnection(SystemClasses.connString);
     String sql = "select * from authors";
     MySqlCommand cmd = new MySqlCommand(sql, cnn);
     cnn.Open();
     MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read()) {
         Author a = new Author();
         a.authorId = int.Parse(reader["author_id"].ToString());
         a.authorName = reader["author_name"].ToString();
         authors.Add(a);
     }
     return authors;
 }