实习开始一周了,今天终于做出了一个Demo,菜鸡本菜了,下面开始正题:
这次的demo是一个经典三层项目,首先是前端的代码(因为这块儿刚接触,对小菜本菜来说最难),
.aspx.cs代码:
using DLL;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class Default3 : System.Web.UI.Page
{
public static string returnValue = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) //初次加载该页
{
returnValue = "[";
DataTable list;//声明表变量
list = UserManage.table();
foreach (DataRow dr in list.Rows)
{
string dataY = "";
string dataX = "";
dataX = "[" + dr["DataTime"].ToString() + ",";
dataY = dr["SY1"].ToString() + "]";
returnValue += dataX + dataY + ",";
}
returnValue = returnValue.Substring(0, returnValue.Length - 1)+"]" ;
}
}[WebMethod]
public static int[] getData()
{
DataTable temp;//声明表变量
temp = UserManage.table();
int