当前位置:首页 » 网页前端 » web学生信息表录入
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

web学生信息表录入

发布时间: 2023-03-30 15:54:55

Ⅰ 民教网怎么录入学生信息

1、首先登陆民教网,点击个人信息登陆。数游
2、其次点击培毕扮首页的信息录入,根据要求填入个人各项信息。
3、最后配灶查看信息后,确认即可。

Ⅱ javaweb的学生注册登录(学号,姓名,密码),删除,修改

如果不多的话就直接修改 要更新就 update table set id='19'+substring(id,1,4)+'00'+substring(id,5,3)

Ⅲ JavaWeb小问题,给定4个表(学生表,班级表,科目表,学生成绩表)

这种作业 做起来没什么意思

Ⅳ 设计一个excel文件导入的web网页,excel列需要导入用户姓名,年龄,职业等信息

1. 要正确的将Web客户端的Excel文件导入到服务器的数据库中,需要将客户端的Excel文件上传到服务器上。可以使用FileUpload控件完成。
2. Excel文件上传到服务器指定的目录中,这里假设是该站点的upfiles目录中。
3. 使用SQL语句从upfiles目录中的上传Excel文件中读取数据显示或写入数据库。
相关代码如下:
1. 前台文件:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StudentInforInport.aspx.cs" Inherits="StudentInforInport" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<title>从Excel表中导入学生数据</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width: 96%; border-collapse: separate; text-align: center">
<tr>
<td colspan="3">
从Excel中导入</td>
</tr>
<tr>
<td colspan="3" style="text-align: left; height: 9px;">
</td>
</tr>
<tr>
<td align="center" style="width: 20%;">
请选择Excel文件路径</td>
<td align="center" style="width: 483px; height: 18px; text-align: left">
<asp:FileUpload ID="FileUpload1" runat="server" Width="555px" /></td>
<td align="center" style="width: 10%">
<asp:Button ID="Btn_Inport" runat="server" Text="导 入" OnClick="Btn_Inport_Click" /></td>
</tr>
<tr>
<td align="center">
请选择表名</td>
<td align="center" style="width: 483px; height: 18px; text-align: left">
<asp:DropDownList ID="DDList_Sheet" runat="server"></asp:DropDownList></td>
<td align="center">
</td>
</tr>
<tr>
<td colspan="3">
<asp:GridView ID="GV_Excel" runat="server" Height="133px" Width="100%">
</asp:GridView>
</td>
</tr>
<tr>
<td style="height: 18px">
</td>
<td style="width: 483px; height: 18px;">
</td>
<td style="width: 243px; height: 18px;">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
2. 后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;
public partial class StudentInforInport : System.Web.UI.Page
{
string strConn = System.Configuration.ConfigurationManager.AppSettings["strconn"].ToString().Trim(); //链接SQL数据库
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// 查询EXCEL电子表格添加到DATASET
/// </summary>
/// <param name="filenameurl">服务器路径</param>
/// <param name="table">表名</param>
/// <param name="SheetName">Sheet表名</param>
/// <returns>读取的DataSet </returns>
public DataSet ExecleDs(string filenameurl, string table, string SheetName)
{
string strConn = "Provider=Microsoft.Jet.OleDb.4.0;" + "data source=" + filenameurl + ";Extended Properties='Excel 8.0'";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
DataSet ds = new DataSet();
OleDbDataAdapter odda = new OleDbDataAdapter("select * from [" + SheetName + "]", conn);
odda.Fill(ds, table);
return ds;
}
protected void Btn_Inport_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile == false) //HasFile用来检查FileUpload是否有指定文件
{
Response.Write("<script>alert('请您选择Excel文件')</script> ");
return; //当无文件时,返回
}
string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
if (IsXls != ".xls")
{
Response.Write("<script>alert('只可以选择Excel文件')</script>");
return; //当选择的不是Excel文件时,返回
}
string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + FileUpload1.FileName; // 获取Execle文件名 DateTime日期函数
string savePath = Server.MapPath(("~\\upfiles\\") + filename); //Server.MapPath 获得虚拟服务器相对路径
FileUpload1.SaveAs(savePath); //SaveAs 将上传的文件内容保存在服务器上
OperExcel Excel = new OperExcel();
ArrayList AL_ExcelSheet = new ArrayList();
AL_ExcelSheet = Excel.ExcelSheetName(savePath);
DDList_Sheet.Items.Clear();
for (int i = 0; i < AL_ExcelSheet.Count; i++)
{
DDList_Sheet.Items.Add( AL_ExcelSheet[i].ToString() );
}
SqlConnection cn = new SqlConnection(strConn);
cn.Open();
DataSet ds = ExecleDs(savePath, filename, DDList_Sheet.Items[0].ToString()); //调用自定义方法得到数据
DataTable dt = ds.Tables[0];
if (dt.Rows.Count == 0)
{
Response.Write("<script>alert('Excel表为空表,无数据!')</script>"); //当Excel表为空时,对用户进行提示