Dispose
, MapPath
, Parameters
, Repeater
, SelectCommand
, Server
, and SqlDataSource
, but not all the keywords used, will be given.
Though the keywords are provided, you still need to know where and how to put them.
SQLDataSource
is needed such as:
<asp:SqlDataSource ID="authors" runat="server" ConnectionString= "<%$ ConnectionStrings:ConnectionString %>" ProviderName= "<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [authorName] FROM [authors]"> </asp:SqlDataSource> |
ID
and Command
need to be specified.
public partial class _Default : System.Web.UI.Page { protected void Page_Load( object sender, EventArgs e ) { ... } protected void Button1_Click( object sender, EventArgs e ) { ... } } |
<%@ Page Language="C#" AutoEventWireup="false" CodeDatabase="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <form id="form1" runat="server"> ... </form> </body> </html> |
using System; using System.Data.OleDb; public partial class _Default : System.Web.UI.Page { Protected Sub Event_Click( object sender, EventArgs e ) { OleDbConnection conn = new OleDbConnection( @"Provider=Microsoft.ACE.OleDb.12.0;Data Source=" + Server.MapPath( "Access\\database.mdb" ) ) ... } } |
⇒
SQL commands (including SQL commands used in Exercise III)
⇒
output
⇒
C# scripts
⇒
ASP.NET scripts