Click here to Skip to main content
15,916,846 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Count the alphabet and Numeric from a string Pin
Peter Leow31-Jan-15 2:35
professionalPeter Leow31-Jan-15 2:35 
AnswerRe: Count the alphabet and Numeric from a string Pin
Anurag Gandhi31-Jan-15 23:25
professionalAnurag Gandhi31-Jan-15 23:25 
Questionforum Pin
Member 1140791030-Jan-15 19:24
Member 1140791030-Jan-15 19:24 
AnswerRe: forum Pin
Anurag Gandhi31-Jan-15 0:17
professionalAnurag Gandhi31-Jan-15 0:17 
QuestionRe: forum Pin
ZurdoDev2-Feb-15 3:12
professionalZurdoDev2-Feb-15 3:12 
Answerform with html css but I don't know asp Pin
Member 1141563430-Jan-15 10:55
Member 1141563430-Jan-15 10:55 
QuestionWhy should I use Interface type of object in Constructor instead of Actual Class Object Pin
Amy Dev29-Jan-15 0:42
Amy Dev29-Jan-15 0:42 
AnswerRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
Anurag Gandhi29-Jan-15 6:28
professionalAnurag Gandhi29-Jan-15 6:28 
AnswerRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
F-ES Sitecore2-Feb-15 2:32
professionalF-ES Sitecore2-Feb-15 2:32 
GeneralRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
Erik Funkenbusch7-Feb-15 15:38
Erik Funkenbusch7-Feb-15 15:38 
GeneralRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
F-ES Sitecore8-Feb-15 13:08
professionalF-ES Sitecore8-Feb-15 13:08 
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 

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.