Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

ddl seach

Avatar of Romacali
Romacali asked on
ASPC#
20 Comments1 Solution474 ViewsLast Modified:
Hello,

How can I write the case selection for my search page.. I started from a expert help, but I have no idea how can I say :


            case 1: //teens  ddl = 1 ????
                storedProcName = "sp_SFParticipantSearch";
                break;
            case 2: //adults dd = 2 ???
                storedProcName = "sp_SFParticipantSearch_adult";
                break;

thanks,

private void Bind_Search()
    {
        string storedProcName = string.Empty;
        switch (int.Parse(ddlParticipantType.SelectedValue))
        {
            case 1: //teens 
                storedProcName = "sp_SFParticipantSearch";
                break;
            case 2: //adults
                storedProcName = "sp_SFParticipantSearch_adult";
                break;
            case 3: //seniors
                storedProcName = "sp_SFParticipantSearch_senior";
                break;
            case 4: //staff
                storedProcName = "sp_SFParticipantSearch_staff";
                break;
            case 0: //nothing selected. Could display error here or go with a default stored proc
                throw new NotImplementedException("No Type selected. Not sure of desired behavior");


                SqlCommand cmd3 = new SqlCommand("storedProcName", myConnection);
                cmd3.CommandType = CommandType.StoredProcedure;
                // Add your parameters here
                cmd3.Parameters.Add(new SqlParameter("@FileNo", txtFileNo.Text.Trim()));
                cmd3.Parameters.Add(new SqlParameter("@OrgID", Session["sOrgID"].ToString()));

                myConnection.Open();

                SqlDataReader reader = cmd3.ExecuteReader();

                gridsearch.DataSource = reader;
                gridsearch.DataBind();

                reader.Close();
                myConnection.Close();
        }
    }
ASKER CERTIFIED SOLUTION
Avatar of Rajar Ahmed
Rajar AhmedFlag of India imageConsultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answers