基于数字化校园的招生系统共享信息结构设计
2019-05-13周苏峡
周苏峡
摘要:该文简要介绍了基于数字化校园的招生信息系统数据结构设计的基本构架,主要从应用的角度给出了系统主要数据表的组织结构,并给出了数据导入导出的基本代码,针对基于数字化校园的招生信息系统数据共享进行了一些思考和探索。
关键词:數字化校园;招生系统;数据共享;结构设计
中图分类号:TP311.1 文献标识码:A 文章编号:1007-9416(2019)01-0142-03
1 项目的创新情况
本系统基于校园网建设,主要功能特点包括:信息安全隔离;招生者与考生之间的QQ聊天信息管理和实时答疑;对招生信息建立的过程与状态进行及时的考查与评估;达到了能够有的放矢并与考生及时的联络跟进;提供有SQL Server与Excel之间的数据导入与导出,大大减轻了操作者的录入负担;提供有高效方便的信息查询手段从而极大地提高工作效率;应用者之间建立有多种资源共享方式,充分体现了信息社会及智慧校园的优势。
2 关键技术指标
系统关键技术指标如表1所示。
3 系统功能结构图
系统功能结构图所图1所示。
4 主要数据表结构
系统主要数据表结构如表2所示。
5 数据的导入与导出
5.1 将Excel电子表数据导入到Sql Server数据库(篇幅所限,省去代码前面的公共包引用部分)
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 (学号,姓名,性别,招生片区,电话,密码,跟踪数量) 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数据导出到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 招生片区,姓名";
Zsx4561 = "ks"; break;
case "招生教师信息表":
SqlComm = "select 工号,姓名,性别,招生片区,所属院系 from zs_teacher order by 招生片区,工号"; Zsx4561 = "zs_tea"; break;
case "招生学生信息表":……p>
