02 | using System.Data.OleDb; |
04 | public partial class NextPage : System.Web.UI.Page { |
05 | protected void authorList_SelectedIndexChanged( object sender, EventArgs e ) { |
06 | OleDbConnection conn = new OleDbConnection( |
07 | @"Provider=Microsoft.ACE.OleDb.12.0;Data Source=" + |
08 | Server.MapPath( "Access\\bookstore.accdb" ) ); |
09 | String sql = "SELECT authorID, authorName, email " ; |
10 | sql += "FROM authors WHERE authorName = @authorName" ; |
11 | OleDbCommand cmd = new OleDbCommand( sql, conn ); |
12 | cmd.Parameters.AddWithValue( "@authorName" , authorList.SelectedValue ); |
14 | var dbread = cmd.ExecuteReader( ); |
15 | author.DataSource = dbread; |
|