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
karthik jogaian
NA
6
11.6k
Not displaying anything in Gridview
Oct 2 2014 10:56 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
public partial class DispalyData : System.Web.UI.Page
{
string strcon = ConfigurationManager.ConnectionStrings["TestConnectionString"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strcon);
SqlCommand cmd = new SqlCommand("Select * from ws_Students where DOB=@DOB", con);
SqlParameter param = new SqlParameter("@DOB",DbType.DateTime);
param.Value = DateTime.Now.ToString();
cmd.Parameters.Add(param);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
con.Close();
}
}
This is the code where I want to display ID, Name, Scholar from table ws_Students and also added DOB as parameter in a Gridview
.
But error is not showing and gridview is not displayed in browser. Is there any thing to add in database or in cs file?
Please provide solution . Thanks in Advance.
Reply
Answers (
3
)
Adding data in related Access Database using C# as language.
Call function from another form