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
surabhi susheel
NA
1
2.8k
cant bind data from sql server 2008 r2 to gridview through vs2010
May 4 2012 8:09 AM
Hi
i have a requirement , i want to display the users in a webpart.
i have done some coding but it is not working.
i want to display the data from sql server table to a grid view in vs2010 through a web part
my code is
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd;
SqlDataAdapter da;
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection("Data Source=spsrv;Initial Catalog=GrandCacheCodeDB;User Id=sa;Password=Pass1234;Integrated Security=True");
con.Open();
string str = ("select UserId,UserName from aspnet_Users ");
cmd = new SqlCommand(str, con);
da = new SqlDataAdapter(cmd);
da.Fill(ds, "aspnet_Users");
gv.DataSource = ds.Tables[0];
gv.DataBind();
con.Close();
}
}
}
the data is not geting binded to the gridview can u halp me out
Reply
Answers (
1
)
Draw Trend Line for SSRS 2005 Line Chart
Dynamic Query In Sql