无法显示数据库中的原始总数 [英] cannot display total raw from database

查看:97
本文介绍了无法显示数据库中的原始总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai,删除当前用户后,我有一个问题要显示数据库中的总行数.我正在使用按钮删除来删除数据表单数据库.删除数据后,我想显示当前用户表单的数据库总数.为此,我使用命令me.StaffDataGridView.Row.Count从数据库中获取行的总数.删除当前用户后,我只得到答案There Are 1 Staff注册.为您的信息我表中共有23行,我将其命名为staff.这是我正在使用sql 2005和visual studio 2005的编码.请更正我的编码.

Hai , i have a probleam to display total row from database after i delete current user. I am using button delete to remove data form database. After remove the data I want to display total current user form database .For this process i am using command me.StaffDataGridView.Row.Count to get total of row from database.After i remove the current user i only get answer There Are 1 Staff Register .For your info i have 23 total row in my table which i name it as staff. Here is my coding which i am using sql 2005 and visual studio 2005. Please correct my coding please.

Public Class User
Dim count As Integer = 0

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnremove1.Click
MsgBox(" Are You Confirm ?", MsgBoxStyle.YesNo) = vbYes Then
Me.StaffBindingSource.RemoveCurrent()
Me.StaffBindingSource.EndEdit()
Me.StaffTableAdapter.Update(Me.LoginDataSet.staff)
Me.ValidateChildren()
End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
count = Me.StaffDataGridView.Row.Count
Label5.Text = "There Are " & count & " Staff Register"
End Sub
End class

推荐答案

首先,您需要更改

First, you need to change

count = Me.StaffDataGridView.Row.Count







to

count = Me.StaffDataGridView.Rows.Count



您没有所有的代码.首先,计时器会发出滴答声吗?它不会在任何地方显示,因此您需要仔细检查.

然后,在
设置一个断点



You don''t have all your code. First, is the timer firing ticks? It doesn''t show anywhere, so you''ll want to double check that.

Then, setup a break point at

count = Me.StaffDataGridView.Rows.Count



Me.StaffDataGridView.Rows.Count的值是什么?

您可能还考虑将计数更改为属性.当它是一个属性时,您可以在"SET"旁边设置一个断点,以便查看何时将其更改为什么值.



What is the value of Me.StaffDataGridView.Rows.Count?

You might also consider changing the count to a property. When it''s a property, you can set a break point withing the "SET", so that you can see when and what value it''s being changed to.


这篇关于无法显示数据库中的原始总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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