In this post , I explained how to Bind data set values to list box. I have used stored procedures in this article. Here lbFunctions is my list box ID.
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
usingTelerik.WinControls;
usingSystem.Data.SqlClient;
usingMicrosoft.ApplicationBlocks.Data;
namespace Company
{
public partial class NamedFunctions : Telerik.WinControls.UI.RadForm
{
private void getNames()
{
try
{
SqlConnectioncon = new SqlConnection(”connectionString”);
da = newSqlDataAdapter("Your_StoredProcedure_Name ", con);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
dsDetails = new DataSet();
da.Fill(dsDetails, "Details");
for(int i = 0; i < dsDetails.Tables[0].Rows.Count; i++)
{
lbFunctions.Items.Add(dsDetails.Tables[0].Rows[i]["TABLE_FIELD_NAME"]);
}
}
catch(Exception ex)
{
}
}
}
}