You are on page 1of 1

http://www.codeproject.com/Answers/203271/DataReader-error-datetime-picker.

aspx#answer1

cmd.CommandText = "select * from clubAC where accountno = " + txtacno .Text + ""; cmd .Connection =cn ; SqlDataReader dr = cmd.ExecuteReader(); if (dr .Read ()) { txtname.Text = dr["name"].ToString(); txtnomadd.Text = dr["address"].ToString(); txtage.Text = dr["age"].ToString(); txtsex.Text = dr["sex"].ToString(); dateTimePicker1.Value = Convert.ToDateTime.dr["dateofcommencement"].ToShortDateString; //dateTimePicker2.Value = dr["duedate"].ToString(); txtterm.Text = dr["term"].ToString(); //dateTimePicker3.Value = dr["lastpaymentdate"].ToString(); txtbkamt.Text = dr["bookingamount"].ToString(); txtamtpay .Text = dr["fullpayableamount"].ToString(); //dateTimePicker4.Value = dr["dateoptrfdpay"].ToString(); txtassocode.Text = dr["associatecode"].ToString(); txtmodepay.Text = dr["modeofpaymengt"].ToString(); txtoptrfdpay.Text = dr["optionalrefundpay"].ToString(); txtassoname.Text = dr["associatename"].ToString(); txtnomage.Text = dr["nomineeage"].ToString(); txtnomadd.Text = dr["nomineeaddress"].ToString(); txtnomname.Text = dr["nomineename"].ToString(); txtnomrel.Text = dr["relation"].ToString(); cmd.Dispose(); dr.Close(); }

You might also like