<%@ Page Language="C#" %>

<%
    //  声明记录哈希对象
    Chukeh.Data.IHash _Detail = new Chukeh.Data.IHash();
    //  连接数据库
    Chukeh.Data.SqlProvider _Provider = new Chukeh.Data.SqlProvider("SERVER=.;UID=sa;PWD=123456;DATABASE=test");
    //  获取指定记录
    _Detail = _Provider.RunRecord("DB_TABLE", Chukeh.Current.Querys);
    //  插入扩展属性
    _Detail.Add("Exists", _Provider.RunExists("DB_TABLE", Chukeh.Current.Querys).Message);
    _Detail.Add("State1Checked", (_Detail.GetInt("State") == 1) ? "Checked" : "");
    _Detail.Add("State2Checked", (_Detail.GetInt("State") == 1) ? "" : "Checked");
    _Provider.Dispose();
    //  初始化页面参数
    Chukeh.Current.AddItems("PageTitle", (Chukeh.Current.Querys.ContainsKey("Id", true) == String.Empty ? "添加新记录" : "修改记录信息"));
    Chukeh.Current.AddItems("FormCommand", (Chukeh.Current.Querys.ContainsKey("Id", true) == String.Empty ? "Add" : "Edit"));
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>数据库操作示例</title>
    <link href="../Styles/Style.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <h3><a href="../index.htm">Chukeh.Data 小诸葛</a> - Sql Server 数据库操作示例，使用模版方式</h3>
    <div>
        <% Chukeh.Current.IncludeFile("/SqlB/DetailTemplate.htm", _Detail);  %>
    </div>
</body>
</html>