Does anyone see my mistake?

L

Leon

Does anyone see my mistake? I'm trying to load the school dropdownlist when
the user select a state from the state dropdownlist. The states drop down
list loads, but the school drop down list donot.

****Database Object Class........................

' Methods
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -

Public Function GetStateList() As DataSet
Return RunProcedure( _
"GetState", New IDataParameter() {}, "States")
End Function

Public Function GetSchoolByStateList(ByVal StateID As String) As
DataSet
Dim parameters As SqlParameter() = { _
New SqlParameter("@StateID", SqlDbType.VarChar, 2)}
parameters(0).Value = StateID
Return RunProcedure( _
"GetSchoolByState", New IDataParameter() {}, "SchoolByState")
End Function

****Business Object Class........................

' Private variables
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Private Shared myStateID As String

' Methods
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -

Public Shared Function GetStates() As DataSet

Dim tool As New StuLotto.Accounts.Data.AccountsTool

Return tool.GetStateList

End Function

Public Shared Function GetSchoolByState() As DataSet

Dim tool As New StuLotto.Accounts.Data.AccountsTool

Return tool.GetSchoolByStateList(myStateID)

' Properties
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Public Shared Property StateID() As String
Get
Return myStateID
End Get
Set(ByVal value As String)
myStateID = value
End Set
End Property

End Class

End Function

****.aspx Codebehind page...........................

' Bind the state drop-down combobox
Dim States As New DataSet
States = Accounts.Business.AccountsTool.GetStates
SStateDDL.DataSource = States
SStateDDL.DataTextField = "Description"
SStateDDL.DataValueField = "StateID"
SStateDDL.DataBind()

' Bind the school by selected state drop-down combobox
Private Sub SStateDDL_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
SStateDDL.SelectedIndexChanged
Dim Schools As New DataSet
Dim Value As String = _
Accounts.Business.AccountsTool.StateID =
SStateDDL.SelectedItem.Value
Schools = Accounts.Business.AccountsTool.GetSchoolByState
SNameDDL.DataSource = Schools
SNameDDL.DataTextField = "SchoolName"
SNameDDL.DataValueField = "SchoolID"
SNameDDL.DataBind()
End Sub
 
D

David Browne

Leon said:
Does anyone see my mistake? I'm trying to load the school dropdownlist
when the user select a state from the state dropdownlist. The states drop
down list loads, but the school drop down list donot.

****Database Object Class........................

' Methods
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -

You are not passing the @StateID parameter into RunProcedure.

Shouldn't this be

Public Function GetSchoolByStateList(ByVal StateID As String) As
DataSet
Dim parameters As SqlParameter() = { _
New SqlParameter("@StateID", SqlDbType.VarChar, 2)}
parameters(0).Value = StateID
Return RunProcedure( _
"GetSchoolByState", parameters, "SchoolByState")
End Function

?

David
 
L

Leon

Thanks for you response!
yes, "Return RunProcedure( "GetSchoolByState", parameters,
"SchoolByState")" you are right do you see any more errors?
 
J

Jeff Dillon

Are you able to run this in the debugger?

Jeff

Leon said:
Thanks for you response!
yes, "Return RunProcedure( "GetSchoolByState", parameters,
"SchoolByState")" you are right do you see any more errors?
 
L

Leon

well I'm programming in vs.net 2003. I think I know how to efficiently run
the debugger.
 
J

Jeff Dillon

So does it work in the debugger or not? Can you set breakpoints to see the
execution, and view the variables as you expect?

Jeff
 
L

Leon

my get set accessor function is not working, I'm trying to figure-out why?
PLEASE HELP!
 
J

Jeff Dillon

I can't help unless you answer my questions. I ask specific questions, and
require specific answers.
 
G

Guest

Leon, see my response to your identical post from last night--it's very odd
that your get/set accessor is playing with a *shared* variable, not to
mention that you're then touching that private variable again from within
GetSchoolByState. As for efficiently using the debugger, that may be, but
you're sure not giving anybody reason to believe that you're tracing through
the code and setting watchpoints on the value you're losing.

Bill
 
L

Leon

I got it! Thanks for all the help!!!!
Bill Borg said:
Leon, see my response to your identical post from last night--it's very
odd
that your get/set accessor is playing with a *shared* variable, not to
mention that you're then touching that private variable again from within
GetSchoolByState. As for efficiently using the debugger, that may be, but
you're sure not giving anybody reason to believe that you're tracing
through
the code and setting watchpoints on the value you're losing.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top