TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sam123
NA
45
2.2k
c# developement
Apr 5 2020 1:02 AM
Question -
The below code is succesfully pulling the data from Activity table but while storing the data and displaying using gridview instead of showing name it is showing the ID.
public void BindSupportActivity_Activity()
{
try
{
using (SqlConnection sqlCon = new SqlConnection(@"Data Source=IN5CG9299JKK;Initial Catalog=table;Trusted_Connection=True"))
{
{
sqlCon.Open();
string query = "select * from mActivity";
SqlDataAdapter sqladpt = new SqlDataAdapter(query, sqlCon);
DataTable dt = new DataTable();
sqladpt.Fill(dt);
Activity.DataSource = dt;
Activity.DataBind();
Activity.DataTextField = "ActivityName";
Activity.DataValueField = "ID";
Activity.DataBind();
sqlCon.Close();
}
}
Activity.Items.Insert(0, new ListItem("", ""));
}
catch (Exception ex)
{
throw;
}
}
Reply
Answers (
3
)
C code of Assemble code?
Need to fetch data from token-based API