c#寫的學生管理系統的心得1
1.html檔案中引入另一個html檔案,用 #parse("../include/header.htm"),最好不要用<iframe scrolling="no" marginwidth="0" marginheight="0" width="100%" height="50" src="/include/header.htm" frameborder="0"></iframe>這種形式的
2.需要連線資料庫和匯入sqlhelper(資料庫裡邊的一些方法)和引用Nvelocity(渲染html頁面)
連線資料庫需要在web.config中配置:
<connectionStrings>
<add name="connstr" connectionString="Data Source=.;Initial Catalog=stuentsystem;User Id=sa;Password=136156a;"/> --stuentsystem資料庫名稱
</connectionStrings>
3.可以往Data存多個數據:
DataTable dt = SqlHelper.ExecuteDataTable("select * from class where [email protected]_ID", new SqlParameter("@CLASS_ID", id));
DataTable dts = SqlHelper.ExecuteDataTable("select * from teacher");
var Data = new { team = dt.Rows[0], teachers=dts.Rows};
string html = CommonHelper.RenderHtml("editteam.html", Data);
context.Response.Write(html);
相應的前臺可以通過$Data.team和$Data.teachers呼叫
4.比如班級(班級表中)裡邊得到所有的班主任老師名稱(在另一個數據表teacher中) 新增頁面
相當於遍歷老師表:
前臺:<td>
<select name="teacher">
<option>請選擇</option>
#foreach($p in $Data.teachers)
<option value="$p.TEACHER_ID">$p.NAME</option>
#end
</select>
</td>
後臺(需要得到teachers):
DataTable dt = SqlHelper.ExecuteDataTable("select * from teacher");
var Data = new { teachers = dt.Rows };
string html = CommonHelper.RenderHtml("addteam.html", Data);
context.Response.Write(html);
5.編輯頁面 顯示已經選擇的老師名稱,並且遍歷
前臺:
<tr>
<td>班主任老師</td>
<td>
<select name="teacher">
#foreach($p in $Data.teachers)
#if($Data.team.TEACHER_ID == $p.TEACHER_ID) --班級裡的老師ID和教師表裡的id一致的時候,顯示老師名稱;否則顯示所有的老師名稱
<option value="$p.TEACHER_ID" selected="selected">$p.NAME</option>
#else
<option value="$p.TEACHER_ID">$p.NAME</option>
#end
#end
</select>
</td>
</tr>
後臺:需要得到當前編輯的班級和教師列表
DataTable dt = SqlHelper.ExecuteDataTable("select * from class where [email protected]_ID", new SqlParameter("@CLASS_ID", id));
DataTable dts = SqlHelper.ExecuteDataTable("select * from teacher");
var Data = new { team = dt.Rows[0], teachers=dts.Rows};
string html = CommonHelper.RenderHtml("editteam.html", Data);
context.Response.Write(html);
6.模糊查詢:
DataTable dt = SqlHelper.ExecuteDataTable("select * from class_teacher where C_NAME
like @C_NAME", new SqlParameter("@C_NAME", "%" + searchText + "%"));
--searchText為輸入框的name
好了,現在就這麼多吧,別的問題暫時還沒怎麼遇到呢
相關推薦
C語言—學生管理系統
2018.11.14 將連結串列作為記憶體資料模型,將檔案作為資料庫,將終端作為互動介面。 讀檔案生成連結串列,修改連結串列寫入檔案。 1.初始化現有資料。 2.讀檔案生成連結串列。 3.操作連結串列(增、查、改、刪、排序)。 4.寫連結串列到檔案。 (Linux下vim編輯器) 1
PHP初學者自寫學生管理系統
初寫 學生管理系統(初學者記錄) 1.後臺登陸頁面 <?php try { $o="mysql:host=127.0.0.1;dbname=testx"; $username="root"; $password="root"; $pdo
史上最詳細c語言學生管理系統(完整的原始碼)
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<conio.h> struct student { char sno[12]; char n
純C語言學生管理系統(學生期末作業)
** 純C語言學生管理系統(學生期末作業) ** 分為7大功能:增、刪、查、改、預覽、儲存、匯出 程式碼都加有註釋,利於不懂的,理解 新增功能 //新增學生 void input () { int i; int j,ge; DaoChu(); printf("
JAVA使用GUI編寫一個簡單的學生管理系統0.1版本--學生登陸介面
JAVA入門,寫的不好請多包涵,如有不懂,下方可提問,有問會必答! import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Login{ public stati
交通燈管理系統-心得1-專案需求分析和畫圖分析
1.交通燈管理系統的專案需求 模擬實現十字路口的交通燈管理系統邏輯,具體需求如下: Ø 非同步隨機生成按照各個路線行駛的車輛。 例如: 由南向而來去往北向的車輛 ----
C語言學生管理系統
自己用C語言寫的學生管理系統,資料存入檔案。 #include <stdio.h> #include <stdlib.h> #include "common.h" /* 函式:Show 功能:顯示選單 注意:使用後記得清屏 */ void Sho
學生管理系統(1:添加學生信息界面)
his esp dds 顯示 ins com 編譯 只需要 學生管理 源碼上傳至:https://github.com/data1213/QT_Studnt_Manager 添加學生信息界面: 添加學生實現代碼: 需求: 1、點擊確定按鈕時,能夠獲取當前界面的所
c#寫的學生管理系統的心得1
1.html檔案中引入另一個html檔案,用 #parse("../include/header.htm"),最好不要用<iframe scrolling="no" marginwidth="0" marginheight="0" width="100%" heig
用c語言連結串列寫的一個簡單的學生管理系統
在大學由於在學完c語言之後老師佈置了一個寫學生管理系統的課設我寫了一個簡單的學生管理 系統,話不多說,直接上原始碼。 #include<stdio.h> #include<stdlib.h> #include<string.h> char
C++ 實現簡單命令行學生管理系統
什麽 cos wid 屏幕 cit 環境 iterator choice umeng C++ 實現簡單命令行學生管理系統 貼吧ID: 這把問題不大 編譯環境是macOS。system(“clear”) 在windows下請換成 system(“cls”) #include
C語言——單鏈表——學生管理系統
鞏固了一下單鏈表的知識點,並運用單鏈表寫了個簡單的學生管理系統 實現功能:增、刪、改、查 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #includ
C/S模型-多程序-簡易版學生-管理系統(帶資料庫)
簡介: 【1】資料: 學生資訊:姓名name + 賬號account + 分數score 登入資訊:賬號account + 密碼password(學生、管理員) 【2】C/S模型,使用fork實現多程序互動 【3】Client: 1)登入:學生登入,管理員登陸 2)管理員:修改密
JAVA入門到精通-第72講-學生管理系統4-model 2模式(1)
刪除、查詢、新增、修改: -修改: 每個欄位都可能修改: //給?賦值 //在prepareStatement語句後面賦值才好用
c語言實現學生管理系統
{{ int i,j,o; char a[20]; system("cls"); printf("修改學生的學號:"); scanf("%s",&a); //通過輸入需要修改資訊的學號找到他 print
C#實現簡單的學生管理系統增刪改查
1.Programs.cs using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using Syste
自寫資訊管理系統—— C 實現
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
計算機專業,畢業答辯專案 自寫資訊管理系統——利用C語言快速實現二
feature.cpp #include"head.h" /********************獲取檔名;讀取內容;給num,fp,head,flieopenname賦值;建立連結串列**********************
python寫的簡答學生管理系統Demo(練習python語法)
python寫的簡單的學生管理系統,練習python語法。 可以執行在windows和linux下,python 2.7。 #!/usr/local/bin/python # -*- coding:utf-8 -*- import os import re #定義學生
C++課程設計:學生管理系統
(一)新生基本資訊統計軟體 有新生來報到,要逐個錄入其資訊,如:學生姓名,性別,專業,出生日期,家庭地址,英語入學成績。要求設計連結串列類來實現,並統計學生人數。文字介面為: 1. 新增學生資訊 2. 刪除學生資訊 3. 匯入學生資訊(已經保存於的檔案資訊) 4. 學生資訊搜尋