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
sivatx
NA
1
0
DELETING THE VALUES IN DATAGRID
Jul 12 2004 2:45 AM
HERE I AM USING THE DATAGRID TO DELETE THE VALUES DIRECTLY. HERE IS THE CODE: If e.CommandName = "Delete" Then Dim strsql As String strsql = "delete from Task_Main where TaskId=" + CType(e.Item.FindControl("TaskId"), Label).Text cmd.Connection = Con cmd.CommandText = strsql If cmd.ExecuteNonQuery > 0 Then lblPname.Text = "You have Selected ProductID " + CType(e.Item.FindControl("TaskId"), Label).Text + " to be deleted" End If End If HERE IS THE ERROR MESSAGE : Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 255: If e.CommandName = "Delete" Then Line 256: Dim strsql As String THE FOLLOWING LINE SHOWES IN RED MARK Line 257: strsql = "delete from Task_Main where TaskId=" + CType(e.Item.FindControl("TaskId"), Label).Text Line 258: cmd.Connection = Con Line 259: cmd.CommandText = strsql
Reply
Answers (
0
)
Binding ListView
Committing changes from bounded Windows Form controls