S
Steven K
Hello,
I am using the following code which works. My question is does the
OleDbDataReader need to be closed and then re-executed for every control?
Is there a more effecient way of doing this other than using a loop?
Thanks in advance, Steven
Dim spTermType As OleDb.OleDbDataReader
Dim prmTermType As OleDbParameter
Dim cmdTermType As New OleDb.OleDbCommand("sp_web_Search", cnnSearch)
cmdTermType.CommandType = CommandType.StoredProcedure
spTermType = cmdTermType.ExecuteReader()
ddlType1.DataSource = spTermType
ddlType1.DataTextField = "TerminationType_ID"
ddlType1.DataTextField = "TerminationType_ID"
ddlType1.DataBind()
spTermType.Close() : spTermType = Nothing
spTermType = cmdTermType.ExecuteReader()
ddlType2.DataSource = spTermType
ddlType2.DataTextField = "TerminationType_ID"
ddlType2.DataTextField = "TerminationType_ID"
ddlType2.DataBind()
I am using the following code which works. My question is does the
OleDbDataReader need to be closed and then re-executed for every control?
Is there a more effecient way of doing this other than using a loop?
Thanks in advance, Steven
Dim spTermType As OleDb.OleDbDataReader
Dim prmTermType As OleDbParameter
Dim cmdTermType As New OleDb.OleDbCommand("sp_web_Search", cnnSearch)
cmdTermType.CommandType = CommandType.StoredProcedure
spTermType = cmdTermType.ExecuteReader()
ddlType1.DataSource = spTermType
ddlType1.DataTextField = "TerminationType_ID"
ddlType1.DataTextField = "TerminationType_ID"
ddlType1.DataBind()
spTermType.Close() : spTermType = Nothing
spTermType = cmdTermType.ExecuteReader()
ddlType2.DataSource = spTermType
ddlType2.DataTextField = "TerminationType_ID"
ddlType2.DataTextField = "TerminationType_ID"
ddlType2.DataBind()