周蘇峽
摘要:該文簡要介紹了基于數(shù)字化校園的招生信息系統(tǒng)數(shù)據(jù)結(jié)構(gòu)設計的基本構(gòu)架,主要從應用的角度給出了系統(tǒng)主要數(shù)據(jù)表的組織結(jié)構(gòu),并給出了數(shù)據(jù)導入導出的基本代碼,針對基于數(shù)字化校園的招生信息系統(tǒng)數(shù)據(jù)共享進行了一些思考和探索。
關(guān)鍵詞:數(shù)字化校園;招生系統(tǒng);數(shù)據(jù)共享;結(jié)構(gòu)設計
中圖分類號:TP311.1 文獻標識碼:A 文章編號:1007-9416(2019)01-0142-03
1 項目的創(chuàng)新情況
本系統(tǒng)基于校園網(wǎng)建設,主要功能特點包括:信息安全隔離;招生者與考生之間的QQ聊天信息管理和實時答疑;對招生信息建立的過程與狀態(tài)進行及時的考查與評估;達到了能夠有的放矢并與考生及時的聯(lián)絡跟進;提供有SQL Server與Excel之間的數(shù)據(jù)導入與導出,大大減輕了操作者的錄入負擔;提供有高效方便的信息查詢手段從而極大地提高工作效率;應用者之間建立有多種資源共享方式,充分體現(xiàn)了信息社會及智慧校園的優(yōu)勢。
2 關(guān)鍵技術(shù)指標
系統(tǒng)關(guān)鍵技術(shù)指標如表1所示。
3 系統(tǒng)功能結(jié)構(gòu)圖
系統(tǒng)功能結(jié)構(gòu)圖所圖1所示。
4 主要數(shù)據(jù)表結(jié)構(gòu)
系統(tǒng)主要數(shù)據(jù)表結(jié)構(gòu)如表2所示。
5 數(shù)據(jù)的導入與導出
5.1 將Excel電子表數(shù)據(jù)導入到Sql Server數(shù)據(jù)庫(篇幅所限,省去代碼前面的公共包引用部分)
using Microsoft.Office.Interop.Excel;
using System.Collections.Generic; using Excel = Microsoft.Office.Interop.Excel;
public partial class inputdata : System.Web.UI.Page
{ static string zsxstr = System.Configuration.ConfigurationManager.AppSettings["data"];
SqlConnection connection = new SqlConnection(zsxstr);
protected void Button_Click(object sender, EventArgs e)
{ string zsxcon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='c:/招生學生信息表.xls';Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;'";
OleDbConnection zsxlj = new OleDbConnection(zsxcon);
OleDbDataAdapter zsxzsx = new OleDbDataAdapter("select * from [Sheet1$]", zsxlj);
DataSet zsx123 = new DataSet(); DataSet xsds = new DataSet(); zsxzsx.Fill(zsx123);
if (zsx123.Tables[0].Rows.Count > 0)
{ string zhousuxia, zhousuxia1, xh;
System.Data.SqlClient.SqlCommand cmd;
connection.Open();
for (int i = 0; i < zsx123.Tables[0].Rows.Count; i++)
{ Label1.Text = "正在導入第 " + (i + 1).ToString() + " 行";
xh = zsx123.Tables[0].Rows[i].ItemArray[0].ToString().Trim();
if (xh != "")
{ zhousuxia1 = "select * from zs_xs where 學號='" + xh + "'";
SqlDataAdapter zsx2 = new SqlDataAdapter(zhousuxia1, connection);
zsx2.Fill(xsds, "zs_xs");
if (xsds.Tables["zs_xs"].Rows.Count == 0)
{ zhousuxia = "insert into zs_xs (學號,姓名,性別,招生片區(qū),電話,密碼,跟蹤數(shù)量) values ('" + xh + "','" + zsx123.Tables[0].Rows[i].ItemArray[1].ToString() + "','" + zsx123.Tables[0].Rows[i].ItemArray[2].ToString() + "','" + zsx123.Tables[0].Rows[i].ItemArray[3].ToString() + "','" + zsx123.Tables[0].Rows[i].ItemArray[4].ToString() + "','" + xh + "','" + zsx123.Tables[0].Rows[i].ItemArray[5].ToString() + "')";
cmd = new System.Data.SqlClient.SqlCommand(zhousuxia, connection);
try
{ cmd.ExecuteNonQuery(); }
catch (Exception ex)
{ Console.WriteLine("操作提示:" + ex.Message); }
}
}
}
connection.Close();
string str = "";
ClientScript.RegisterStartupScript(this.GetType(), "", str);
}
else
{ string str = ""; ClientScript.RegisterStartupScript(this.GetType(), "", str); } } }
5.2 將Sql Server數(shù)據(jù)導出到Excel電子表
using System.Text; using Microsoft.Office.Interop.Excel;
using System.Collections.Generic; using Excel = Microsoft.Office.Interop.Excel;
public partial class outdata : System.Web.UI.Page
{ static string zsxstr = System.Configuration.ConfigurationManager.AppSettings["data"];
SqlConnection connection = new SqlConnection(zsxstr);
protected void Button_Click(object sender, EventArgs e)
{ string Zsx456 =DropDownList1.SelectedValue.Trim();
string SqlComm="",Zsx4561="";
switch (Zsx456)
{ case "考生基本信息表":
SqlComm = "select * from zs_ks_info order by 招生片區(qū),姓名";
Zsx4561 = "ks"; break;
case "招生教師信息表":
SqlComm = "select 工號,姓名,性別,招生片區(qū),所屬院系 from zs_teacher order by 招生片區(qū),工號"; Zsx4561 = "zs_tea"; break;
case "招生學生信息表":
SqlComm = "select 學號,姓名,性別,招生片區(qū) from zs_xs order by 招生片區(qū),姓名";
Zsx4561 = "zs_stu"; break;
}
DataSet zd = new DataSet(); SqlDataAdapter zsx2 = new SqlDataAdapter(SqlComm, connection); zsx2.Fill(zd, Zsx4561); Label3.Text = "正在生成Excel文檔,請稍候...";
System.Data.DataTable dt = ds.Tables[0]; HttpResponse sw; sw = Page.Response;
StringBuilder zsxbs = new StringBuilder();
string zsxws = "
zsxws += @"\@';";
zsxws += "border:1px solid #000000;border-collapse: collapse;\">";
zsxws += "[Content]
Response.Charset = "GB2312"; System.Web.HttpContext.Current.Response.End();
Label3.Text = "導出完成!"; } }
6 結(jié)語
應用系統(tǒng)數(shù)據(jù)結(jié)構(gòu)的設計主要跟應用需求有關(guān),本文主要為我校招生信息共享數(shù)據(jù)結(jié)構(gòu)的設計與應用,其他院校應根據(jù)自身需求進行相關(guān)調(diào)整與設置,使系統(tǒng)信息能高效共享,對工作決策提供服務與支持。
Abstract:In this paper, a brief introduction to the recruitment of students information system based on digital campus the basic framework of the data structure design, mainly from the perspective of the application system of main data table structure was given, and gives the basic code of data import and export for the recruitment of students information system based on digital campus data sharing some thinking and exploration.
Key words:digital campus;recruitment system;data sharing;structure design