如何在网格视图中接受11记录后仅接受Gird视图中的10条记录? [英] How to accept only 10 records in Gird view after 11 record is not accept in grid view?

查看:60
本文介绍了如何在网格视图中接受11记录后仅接受Gird视图中的10条记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的表中只插入10条记录。我想在gridview中显示这些记录,当我想在gridview中插入第11条记录时.Thern必须给出错误,只允许10条记录。

解决方案

< blockquote>插入记录时,使用 SQL COUNT()检查计数[ ^ ]。



如果这是10,然后显示错误信息。


基于OP的评论,



引用:

是..它正在工作,确切的答案是写的,但也需要在数据库中也只有10条记录接受..给我任何建议

Sai Prasad anumolu







 SqlCommand cmd =  SqlCommand( 选择顶部10 *来自Tbl_TextAdds,con); 





尝试这样做只从数据库中获取10条记录并将其绑定到gridview。



检查并分享你的发现。





:)





编辑:对于OP的另一个要求,即限制表行。

您必须使用以下链接触发表格。



可以找到可能的解决方案此处


I want insert only 10 records in my table. And I want to display those records in my gridview and when I suppose to insert 11 th record in gridview .Thern it has to Give error like Only 10 records is allowed.

解决方案

While inserting the records, check the count using the SQL COUNT()[^].

If that is 10, then show error message.


Based on OP's Comment,

Quote:

Yes ..Its working, Exacting you answer is write but also need in database also only 10 records accepting ..tell me any suggestion
Sai Prasad anumolu




SqlCommand cmd = new SqlCommand("Select top 10 *from Tbl_TextAdds", con);



try this to get only 10 records from the database and bind it to gridview.

Check and share your findings.


:)


EDIT: For OP's another requirement i.e Limit table rows.
You have to trigger the table using the link below.

Possible solution can be found HERE.


这篇关于如何在网格视图中接受11记录后仅接受Gird视图中的10条记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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