=================数据库===================
数据库中的学生表
create table tb_student
(
studentId char(11),
studentName char(10),
classId char(9),
primary key(studentId),
foreign key(classId) references tb_class(classId)
)
建的触发器
create proc sp_InsertStudent
@studentId char(11), @studentName char(11),@classId char(11)
as
insert into tb_student(studentId,studentName,classId) values (@studentId,@studentName,@classId)
================ASP.NET================
<div>
<table>
<tr>
<td>添加学生</td>
</tr>
<tr>
<td>学号:<asp:TextBox ID="txtStudentId" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>姓名:<asp:TextBox ID="txtStudentName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>班级编号:<asp:TextBox ID="txtClassId" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Button ID="btnAdd" runat="server" Text="添加" onclick="btnAdd_Click" />
</td>
</tr>
</table>
</div>
后台代码
protected void btnAdd_Click(object sender, EventArgs e)
{
string studentId = txtStudentId.Text;
string stuentName = txtStudentName.Text;
string classId = txtClassId.Text;
... ....
}
请高手为我填上程序缺失的部分,我想用数据库中的存储过程,实现添加学生的功能。