问题与学生注册号有关 [英] question realated to registration no of student

查看:99
本文介绍了问题与学生注册号有关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在文本框中根据所选类别从下拉列表中自动生成学生注册号码.classname / registrationno / 2014我们如何做

i want to auto genrate student registration no in textbox according to selected class from dropdownlist in such format..classname/registrationno/2014 how we can do

推荐答案

在每个数据库服务器中都存在自动增量功能。



在SQL Server中你有IDENTITY。

在Oracle中你有SEQUENCE。



所以你可以使用任何一个功能来实现这个目的。
In every DB server auto increment feature exist.

In SQL Server you have IDENTITY.
In Oracle you have SEQUENCE.

So you can use any of the feature to achieve this.


something like below,

registrationNumber.Text=ClassnameDropDownList.SelectedValue+"/"+(Query database to get no.of students in the class)+"/"+DateTime.Now.Year







Database Query should be something like below

select count(S.No) from Student where classname='ABC' and year='2014'


对于客户端的id生成,然后不使用数据库ID生成

因为它将创建自己的格式,并且它将在删除时产生问题。

对于此使用类并看下面

您的数据库查询可能是这样的

选择isnull(max(S.No),0)+ 1来自Student,其中classname ='ABC'和年份='2014'

和registrationNumber.Text = ClassnameDropDownList.SelectedValue +/+(查询)+/+ DateTime.Now.Year
For id generation acc to client then dont use database id generation
becse it will create itself format and also it will create problem in deleting .
For this use class and see below
your database query may be like this
select isnull(max(S.No),0) + 1 from Student where classname='ABC' and year='2014'
and registrationNumber.Text=ClassnameDropDownList.SelectedValue+"/"+(Query)+"/"+ DateTime.Now.Year


这篇关于问题与学生注册号有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆