using System;
using System.Data.OleDb;
public partial class NextPage : System.Web.UI.Page {
protected void List_SelectedIndexChanged( object sender, EventArgs e ) {
OleDbConnection conn = new OleDbConnection(
@"Provider=Microsoft.ACE.OleDb.12.0;Data Source=" +
Server.MapPath( "Access\\bookstore.accdb" ) );
String sql = "SELECT authorID, authorName, email ";
sql += "FROM authors WHERE authorName = @authorName";
OleDbCommand cmd = new OleDbCommand( sql, conn );
cmd.Parameters.AddWithValue( "@authorName", authorList.SelectedValue );
conn.Open( );
var dbread = cmd.ExecuteReader( );
author.DataSource = dbread;
author.DataBind( );
dbread.Close( );
conn.Close( );
}
}
|