DataTable案例VB.Net [英] DataTable case VB.Net
本文介绍了DataTable案例VB.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你们知道appDt(0)和schedDt(0)的索引类型是什么?他们为什么不指示.rows属性?
Do You guys know what kind of indexing appDt(0) and schedDt(0) have? Why they didn't indicate .rows property instead?
Dim tb As TextBox = CType(UserIdTextBox, TextBox)
Dim userName As String = tb.Text
Dim gvw As GridView = CType(sender, GridView)
Dim scheduleId As Integer = Integer.Parse(gvw.SelectedRow.Cells(1).Text)
Dim caspbll As New CASpBLL
Dim schedDt As tbCASp_ExamScheduleDataTable = caspbll.GetExamSchedule(scheduleId)
Dim appDt As QuickAppInfoDataTable = caspbll.AppInfoSummary(userName)
Dim regDt As tbCASp_RegistrationDataTable = caspbll.GetExamReg(userName, scheduleId)
If appDt IsNot Nothing AndAlso appDt.Rows.Count = 1 Then
If regDt IsNot Nothing AndAlso regDt.Rows.Count = 0 And (Not caspbll.AlreadyRegisteredForThisExam(appDt(0).ApplicationID, schedDt(0).ExamID)) Then
Dim RegNumber As String = ""
Dim RegId As Integer
RegId = caspbll.NewRegistration(appDt(0).ApplicationID, scheduleId, HttpContext.Current.Request.UserHostAddress, RegNumber)
Dim CASp As New CASpBLL
CASp.UpdateExamRegFromDSA601(Today.ToShortDateString(), SpecialAccomodationCheckBox.Checked, NoSaturdayExamCheckBox.Checked, RegId)
Response.Redirect(String.Format("view_registration.aspx?regid={0}", RegId.ToString()))
Else
lblErrorMsg.Visible = True
lblErrorMsg.Text = "User has already registered for a session for this exam"
End If
Else
lblErrorMsg.Visible = True
lblErrorMsg.Text = "UserId doesn't exist."
End If
推荐答案
否如果没有看到您正在访问的对象的代码,您可以真正为您解答此问题。但我希望您的QuickAppInfoDataTable和tbCASp_RegistrationDataTable类型都实现iEnumerator / iEnumerable,因此引用其中一个实例的实例已经为您引用了该行。 http://msdn.microsoft.com/en-us /library/system.collections.ienumerator(v=vs.110).aspx [ ^ ]
No one can really answer this for you without seeing the code for the objects you're accessing. But I'd expect that your QuickAppInfoDataTable and tbCASp_RegistrationDataTable types are both implementing iEnumerator/iEnumerable, so referencing an instance of either is already referencing the row for you. http://msdn.microsoft.com/en-us/library/system.collections.ienumerator(v=vs.110).aspx[^]
这篇关于DataTable案例VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文