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
Deepak Ratan
NA
175
50.6k
Object reference not set to an instance of an object.
May 4 2015 5:56 AM
This is my code:
protected void txtcmd_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connect"].ConnectionString);
SqlCommand cmd = new SqlCommand();
int ID = int.Parse(Session["Id"].ToString());
string comments = ((TextBox)statusgrdview.FindControl("txtcommt")).Text;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into TBL_Comments(ID,comments) " + "values("+ID+",@comments);" + "select * from TBL_Comments";
cmd.Parameters.Add("@comments", SqlDbType.VarChar).Value = comments;
statusgrdview.DataSource = GetData(cmd);
statusgrdview.DataBind();
}
private object GetData(SqlCommand cmd)
{
throw new NotImplementedException();
}
Reply
Answers (
4
)
Object reference not set to an instance of an object.
how to add css to datepicker in asp.net using jquery