Click here to Skip to main content
15,887,214 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
Erik Funkenbusch7-Feb-15 15:52
Erik Funkenbusch7-Feb-15 15:52 
QuestionEmbedding Qr code Scanner[Need Guidance] Pin
Member 1140255328-Jan-15 11:32
Member 1140255328-Jan-15 11:32 
AnswerRe: Embedding Qr code Scanner[Need Guidance] Pin
Member 1140255328-Jan-15 17:38
Member 1140255328-Jan-15 17:38 
QuestionAsp.net Pin
Member 1133602728-Jan-15 10:30
Member 1133602728-Jan-15 10:30 
AnswerRe: Asp.net Pin
Richard MacCutchan28-Jan-15 21:21
mveRichard MacCutchan28-Jan-15 21:21 
AnswerRe: Asp.net Pin
Erik Funkenbusch7-Feb-15 15:55
Erik Funkenbusch7-Feb-15 15:55 
AnswerRe: Asp.net Pin
Rahul Rajat Singh13-Feb-15 0:32
professionalRahul Rajat Singh13-Feb-15 0:32 
QuestionHow to retrieve multiple values from a single SELECT statement? Pin
samflex28-Jan-15 7:02
samflex28-Jan-15 7:02 
How do I retrieve multiple sub category values from a single select statement?

I have the following code:

PHP
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

    If Not IsPostBack Then
        ddlParks.AppendDataBoundItems = True
        Dim strQuery As [String] = "Select parkID, parkName from ParksCategory"
        Dim con As New SqlConnection(strConnString)
        Dim cmd As New SqlCommand()
        cmd.CommandType = CommandType.Text
        cmd.CommandText = strQuery
        cmd.Connection = con
        Try
            con.Open()
            ddlParks.DataSource = cmd.ExecuteReader()
            ddlParks.DataTextField = "parkName"
            ddlParks.DataValueField = "parkID"
            ddlParks.DataBind()
        Catch ex As Exception
            Throw ex
        Finally
            con.Close()
            con.Dispose()
        End Try
    End If
End Sub
Protected Sub ddlParks_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlParks.SelectedIndexChanged

    Dim strQuery As [String] = "select subcatID, subcatName from SubCategory" _
                                & "where parkID=@parkID AND Status=1"
    Dim con As New SqlConnection(strConnString)
    Dim cmd As New SqlCommand()
    cmd.Parameters.AddWithValue("@parkID", _
                         ddlParks.SelectedItem.Value)
    cmd.CommandType = CommandType.Text
    cmd.CommandText = strQuery
    cmd.Connection = con
    Try
        con.Open()

        dr = cmd.ExecuteReader()

        Do While dr.HasRows
            lblfacility.Text = dr.GetName(1)

            Do While dr.Read()

                  lblfacility.Text = dr.GetString(1)
            Loop

            dr.NextResult()
        Loop

    Catch ex As Exception
        Throw ex
    Finally
        con.Close()
        con.Dispose()
    End Try
End Sub


When a user selects a category, there are at least two sub categories associated with the Park Category selection.

Any ideas why the WHILE LOOP I am using is not producing the correct result.

Assume that I have a categoryId of 251 and there are three values associated with this categoryId from subcategory table and assume those IDs are subcat1 subcat2, subcat3, the result being returned so far is subcat3. The first two are ignored.

Thanks in advance for your help.
AnswerRe: How to retrieve multiple values from a single SELECT statement? Pin
PIEBALDconsult28-Jan-15 7:09
mvePIEBALDconsult28-Jan-15 7:09 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
samflex28-Jan-15 7:15
samflex28-Jan-15 7:15 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
PIEBALDconsult28-Jan-15 7:26
mvePIEBALDconsult28-Jan-15 7:26 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
samflex28-Jan-15 7:32
samflex28-Jan-15 7:32 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
PIEBALDconsult28-Jan-15 7:41
mvePIEBALDconsult28-Jan-15 7:41 
AnswerRe: How to retrieve multiple values from a single SELECT statement? Pin
F-ES Sitecore2-Feb-15 2:29
professionalF-ES Sitecore2-Feb-15 2:29 
QuestionMultiple popups using JavaScript Pin
Nav_god27-Jan-15 1:49
Nav_god27-Jan-15 1:49 
SuggestionRe: Multiple popups using JavaScript Pin
Kornfeld Eliyahu Peter27-Jan-15 2:00
professionalKornfeld Eliyahu Peter27-Jan-15 2:00 
AnswerRe: Multiple popups using JavaScript Pin
Member 1050600328-Jan-15 1:09
Member 1050600328-Jan-15 1:09 
AnswerRe: Multiple popups using JavaScript Pin
Nav_god28-Jan-15 3:46
Nav_god28-Jan-15 3:46 
Questionregular expression help Pin
byka26-Jan-15 4:21
byka26-Jan-15 4:21 
AnswerRe: regular expression help Pin
Kornfeld Eliyahu Peter26-Jan-15 5:34
professionalKornfeld Eliyahu Peter26-Jan-15 5:34 
QuestionHow to make Connection string in visual studio 2012 ? Pin
Farid khan kakar25-Jan-15 20:15
Farid khan kakar25-Jan-15 20:15 
AnswerRe: How to make Connection string in visual studio 2012 ? Pin
Kornfeld Eliyahu Peter25-Jan-15 21:56
professionalKornfeld Eliyahu Peter25-Jan-15 21:56 
AnswerRe: How to make Connection string in visual studio 2012 ? Pin
Simon_Whale25-Jan-15 22:09
Simon_Whale25-Jan-15 22:09 
AnswerRe: How to make Connection string in visual studio 2012 ? Pin
Member 1126431526-Jan-15 0:20
Member 1126431526-Jan-15 0:20 
AnswerRe: How to make Connection string in visual studio 2012 ? Pin
Member 1050600328-Jan-15 1:12
Member 1050600328-Jan-15 1:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.