Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7740165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:42:25+00:00 2026-06-01T08:42:25+00:00

I have a stored procedure called WEB_SEL_SECURITY_QUESTIONS in my sql database which returns a

  • 0

I have a stored procedure called “WEB_SEL_SECURITY_QUESTIONS” in my sql database which returns a table as follows.

SEQURITY_QUESTIONS_KEY, KEYCODE, QUESTION

I need to populate a html selectbox with the list of questions I get from executing the above procedure.

This is what I have tried

String s = ConfigurationManager.ConnectionStrings["ConnectionString2"].ToString();
SqlConnection con = new SqlConnection(s);
con.Open();
SqlDataAdapter myAdepter = new SqlDataAdapter("WEB_SEL_SECURITY_QUESTIONS", con);
myAdepter.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
myAdepter.Fill(ds, "WEB_SEL_SECURITY_QUESTIONS");
String questions = ds.Tables["WEB_SEL_SECURITY_QUESTIONS"].Rows[]["QUESTION"].ToString();
securityQuestion1.DataSource = questions;
securityQuestion1.DataBind(); 

But this populates the select box with only one record and it generates the list items in such a way that, only one character per list item and only the first record.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:42:27+00:00Added an answer on June 1, 2026 at 8:42 am

    You could try:

    securityQuestion1.DataSource = ds.Tables["WEB_SEL_SECURITY_QUESTIONS"];
    securityQuestion1.DataTextField = "QUESTION";
    securityQuestion1.DataValueField = "KEYCODE"; // Or whatever the value field needs to be.
    securityQuestion1.DataBind(); 
    

    What your first attempt was doing is just taking that single value from one question and using that as the entire data source. So what you need to aim for is make the whole security questions table the data source, and then give it hints as to what columns to use for value and display (DataTextField, DataValueField).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a stored procedure called Spr_EventLogCreate defined in my database. I have
I have a stored procedure which is called inside a trigger on Insert/Update/Delete. The
I have a stored procedure, which returns the unique identifier after insertion @@identity .
I have a Stored Procedure called spGetOrders which accepts a few parameters: @startdate and
Using sql server 2008, I have a simple stored procedure, the contents of which
I have a stored procedure that returns a table (or dataset or view or
I have a sql stored procedure that I run that returns a class name.
There is a SQL Server undocumented extended stored procedure called xp_dirtree , which can
I have a somewhat-long-running stored procedure being called from a PB application. I want
I'd like to have NHibernate call a stored procedure when ISession.Get is called to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.