3 Replies - 507 Views - Last Post: 30 January 2011 - 12:23 PM Rate Topic: -----

#1 marileena  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 16
  • Joined: 26-January 11

why its not taking TextArea value and not inserting values in db?

Posted 29 January 2011 - 09:24 AM

hi

i m just inserting values...code is running without any error till end ...i have checked at different points. just its fail when i take value from textarea in 'req'.....and its not inserting in db as well. Table name is "RequestPay"....

            ProjContext objCont = new ProjContext();
            int item1 = int.Parse(dd_LeavDayFrom.SelectedItem.Value);
            int item2 = int.Parse(dd_LeavMonthFrom.SelectedItem.Value);
            int item3 = int.Parse(dd_LeavYearFrom.SelectedItem.Value);

            int item4 = int.Parse(dd_Leav_dayTo.SelectedItem.Value);
            int item5 = int.Parse(dd_Leav_MonTo.SelectedItem.Value);
            int item6 = int.Parse(dd_Leav_YearTo.SelectedItem.Value);

            DateTime dt = new DateTime(item3, item2, item1);
            DateTime dt1 = new DateTime(item6, item5, item4);

            RequestLeave req = new RequestLeave();
            req.UName = txt_LeavEmpName.Text;
            req.DateFrom = dt;
            req.DateTo = dt1;
            req.ReqReason = TextArea1.Text;

            
            objCont.RequestLeaves.Insertonsubmit(req);
            objCont.SubmitChanges();
            lbl_LeavSnt.Visible = true;



please anybody could help.... :hang: :(

Is This A Good Question/Topic? 0
  • +

Replies To: why its not taking TextArea value and not inserting values in db?

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 441
  • View blog
  • Posts: 1,488
  • Joined: 28-April 09

Re: why its not taking TextArea value and not inserting values in db?

Posted 29 January 2011 - 02:54 PM

what's the error that you're getting?
Was This Post Helpful? 0
  • +
  • -

#3 marileena  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 16
  • Joined: 26-January 11

Re: why its not taking TextArea value and not inserting values in db?

Posted 30 January 2011 - 04:52 AM

View PostNakor, on 29 January 2011 - 02:54 PM, said:

what's the error that you're getting?


no error...successfully running... thats why em unable to get my mistake:(( somebody suggest me to put all code under

if (!IsPostBack)
{
// paste code here
}




but em doin it under event button_clicked, not under "page_load"....how can if put this statement under "button_click"....should i do that???
Was This Post Helpful? 0
  • +
  • -

#4 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 441
  • View blog
  • Posts: 1,488
  • Joined: 28-April 09

Re: why its not taking TextArea value and not inserting values in db?

Posted 30 January 2011 - 12:23 PM

well if it's failing to put the text from your textarea into the ReqReason property then there's possibly a data conflict between the two. How is ReqReason defined in the database? Can you post the aspx where the controls are as well?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1