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
saifullah khan
NA
335
301.7k
Object reference not set to an instance of an object.
Jun 1 2011 9:11 AM
i have a 5 textboxes in asp.net webpad
i enter the consumerno in the first textbox, and click on the search so that it takes the record of other 4 cells of that particular record and show it in the given 4 textboxes. here is the code:
protected void Button2_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("select * from Arrear where ConsumerNo='" + ConsumerNo.Text + "'", con);
ad.SelectCommand = cmd;
con.Open();
ad.Fill(ds);
ConsumerNo.Text = ds.Tables[0].Rows[0].ItemArray[1].ToString();
WaterCharges.Text = ds.Tables[0].Rows[0].ItemArray[2].ToString();
ConservancyCharges.Text = ds.Tables[0].Rows[0].ItemArray[3].ToString();
SaverageCharges.Text = ds.Tables[0].Rows[0].ItemArray[4].ToString();
arear.Text = ds.Tables[0].Rows[0].ItemArray[5].ToString();
}
but i got the following error:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Line 80: cmd = new SqlCommand("select * from Arrear where ConsumerNo='" + ConsumerNo.Text + "'", con);
Line 81: ad.SelectCommand = cmd;
please help me.
Reply
Answers (
8
)
Word to Pdf Document Conversion
How to create winzip file with password protected