Currenly I have a basic understanding of Asp.Net Web Forms and I was wondering whether another option such as Asp.Net MVC or a WCF Service would be better suited for my needs.

Simplified, I want to create a MySQL database driven website.

For example, I have a 'artist' table in the database. On a basic webpage, there's a textbox and a submit button. Clicking on the submit button searches the database and returns all the infomation for the given artist.

Given my understanding, I could create the UI in a .aspx page and the connection to the db/db query in the code behind file (.aspx.cs page) in a button click event such as the simplified code below:

    MySqlConnection conn = new MySqlConnection(connStr);
    MySqlCommand command = conn.CreateCommand();
    MySqlDataReader Reader;
    command.CommandText = "select artist, website from artist";
    conn.Open();
    Reader = command.ExecuteReader();
    while (Reader.Read())
    {
        lblArtist.Text = Reader["artist"].ToString();
        lblWebsite.Text = Reader["website"].ToString();
    }
    conn.Close();

However, I want to have multiple pages with many different queries.

So is the option of using Web Forms the most appropriate or would another method be better?

Related posts

Recent Viewed