앱ML .NET


.NET 서버에 대한 액세스 권한이 있는 경우 아래 지침에 따라 AppML 서버 애플리케이션을 생성하십시오.


테스트 페이지 만들기

테스트 페이지를 만들고 PHP 서버에 고객.htm(또는 원하는 무엇이든)으로 저장합니다.

고객.htm

<!DOCTYPE html>
<html lang="en">
<title>Customers</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>
<body>

<div class="w3-container" appml-data="customers">
<h1>Customers</h1>
<table class="w3-table-all">
  <tr>
    <th>Customer</th>
    <th>City</th>
    <th>Country</th>
  </tr>
  <tr appml-repeat="records">
    <td>{{CustomerName}}</td>
    <td>{{City}} </td>
    <td>{{Country}} </td>
  </tr>
</table>
</div>

<script>
var customers = {
"records":[
{"CustomerName":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"},
{"CustomerName":"Ana Trujillo Emparedados y helados","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Antonio Moreno Taquería","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Around the Horn","City":"London","Country":"UK"},
{"CustomerName":"B's Beverages","City":"London","Country":"UK"},
{"CustomerName":"Berglunds snabbköp","City":"Luleå","Country":"Sweden"},
{"CustomerName":"Blauer See Delikatessen","City":"Mannheim","Country":"Germany"},
{"CustomerName":"Blondel père et fils","City":"Strasbourg","Country":"France"},
{"CustomerName":"Bólido Comidas preparadas","City":"Madrid","Country":"Spain"},
{"CustomerName":"Bon app'","City":"Marseille","Country":"France"},
{"CustomerName":"Bottom-Dollar Marketse","City":"Tsawassen","Country":"Canada"},
{"CustomerName":"Cactus Comidas para llevar","City":"Buenos Aires","Country":"Argentina"},
{"CustomerName":"Centro comercial Moctezuma","City":"México D.F.","Country":"Mexico"},
{"CustomerName":"Chop-suey Chinese","City":"Bern","Country":"Switzerland"},
{"CustomerName":"Comércio Mineiro","City":"São Paulo","Country":"Brazil"}
]};
</script>

</body>
</html>

브라우저에서 웹 페이지를 테스트합니다.


데이터베이스 연결 생성

SQL Server 데이터베이스 또는 MS Acess와 같은 다른 OLEDB 데이터베이스에 대한 액세스 권한이 있는 경우 데이터베이스 연결을 정의하고 서버에 appml_config.aspx 로 저장합니다 .

appml_config.aspx(SQL 서버 예)

<%
Response.write("Access Forbidden")
Response.end
%>
{
"dateformat" : "yyyy-mm-dd",
"databases" : [{
"connection" : "mydatabase",
"provider"   : "SQLOLEDB",
"host"       : "myserver",
"dbname"     : "DemoDB",
"username"   : "DemoDBUkbn5",
"password"   : "l6|U6=V(*T+P"
}]
}

appml_config.aspx(MS 액세스 예)

<%
Response.write("Access Forbidden")
Response.end
%>
{
"dateformat" : "yyyy-mm-dd",
"databases" : [{
"connection" : "mydatabase",
"connectionstring" :
"Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\\database\\Northwind.mdb"
}]
}

위의 연결은 실제가 아닙니다. 이름과 비밀번호는 예시입니다.


구성 파일 설명:

재산 설명
날짜 형식 모델에서 사용할 날짜 형식
연결 모델에서 사용할 연결 이름
연결 문자열 일반적으로 MS Access와 같은 OLEDB 드라이버에 사용됨
공급자 db 소프트웨어의 드라이버/제공자
주최자 데이터베이스의 IP 또는 호스트 이름
데이터베이스 이름 데이터베이스 이름
사용자 이름 데이터베이스 사용자 이름
비밀번호 데이터베이스 비밀번호

AppML 복사

파일 다운로드: https://www.w3schools.com/appml/2.0.3/appml.aspx.txt .

파일을 웹 사이트에 복사합니다. 이름을 appml.aspx 로 바꿉니다 .


데이터베이스 테이블 생성 

데이터베이스에 Customers 테이블을 생성하기 위한 모델 을 생성합니다.

create_customers.js

{
"database" : {
"connection" : "mydatabase",
"execute" : [
"DROP TABLE IF EXISTS Customers",
"CREATE TABLE IF NOT EXISTS Customers (CustomerID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,(CustomerID),CustomerName NVARCHAR(255),ContactName NVARCHAR(255),Address NVARCHAR(255),City NVARCHAR(255),PostalCode NVARCHAR(255),Country NVARCHAR(255))",
"INSERT INTO Customers(CustomerName,ContactName,Address,City,PostalCode,Country)VALUES (\"Alfreds Futterkiste\",\"Maria Anders\",\"Obere Str. 57\",\"Berlin\",\"12209\",\"Germany\")",
"INSERT INTO Customers(CustomerName,ContactName,Address,City,PostalCode,Country)VALUES (\"Around the Horn\",\"Thomas Hardy\",\"120 Hanover Sq.\",\"London\",\"WA1 1DP\",\"UK\")",
"INSERT INTO Customers(CustomerName,ContactName,Address,City,PostalCode,Country)VALUES (\"Blauer See Delikatessen\",\"Hanna Moos\",\"Forsterstr. 57\",\"Mannheim\",\"68306\",\"Germany\")"
]
}}

create_customers.js 모델을 실행하기 위한 HTML 페이지 를 생성합니다 .

create_customers.htm

<!DOCTYPE html>
<html>
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>
<body>

<div appml-data="appml.aspx?model=create_customers"></div>

</body>
</html>

브라우저에서 HTML 페이지를 실행합니다.


애플리케이션 생성 

고객 애플리케이션에 대한 모델 을 작성하십시오 . customer.js 로 저장합니다 .

고객.js

{
"rowsperpage" : 10,
"database" : {
    "connection" : "mydatabase",
    "sql" : "SELECT * FROM Customers",
    "orderby" : "CustomerName"
}
}

고객 애플리케이션을 실행하기 위한 HTML 페이지 생성 :

고객.htm

<!DOCTYPE html>
<html lang="en">
<title>Customers</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>
<body>

<div class="w3-container" appml-data="appml.aspx?model=model_customers">
<h1>Customers</h1>
<table class="w3-table-all">
  <tr>
    <th>Customer</th>
    <th>City</th>
    <th>Country</th>
  </tr>
  <tr appml-repeat="records">
    <td>{{CustomerName}}</td>
    <td>{{City}}</td>
    <td>{{Country}}</td>
  </tr>
</table>
</div>

</body>
</html>

브라우저에서 HTML을 실행합니다.