数据库:app,表:Student
db.cs文件
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
/// <summary>
/// db 的摘要说明
/// </summary>
public class db
{
public db()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static SqlConnection CreateConnection()
{
SqlConnection con = new SqlConnection("Data Source=PC-201510151352\\MSSQLSERVER1;Initial Catalog=app;User Id=sa;Pwd=1234");
return con;
}
}
Login.aspx文件
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="_Default" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div align="center">
<h1>用户登录页面</h1>
<form id="form1" runat="server">
<p> <asp:Label ID="lbusername" runat="server">用户名:</asp:Label>
<asp:TextBox ID="tbusername" runat="serve