Exception has been thrown from the target of an invocation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dharmeshsoni
    New Member
    • Mar 2008
    • 3

    Exception has been thrown from the target of an invocation

    Hello Friends,

    wen i edit from a grid at that time if the text box is blank becoz no data in database of one field. then if i click on update button on grid. "Exception has been thrown from the target of an invocation" come
    any body can help me
    Thanks
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Maybe you could post the C++ code that shows this problem?

    Comment

    • dharmeshsoni
      New Member
      • Mar 2008
      • 3

      #3
      i havnt use any code for binding with grid,it directly bind through object datasource and the function for edit is.......

      public void EditStatus(stri ng statusname,stri ng statusdesc,int pk_autstatusid)
      {
      db.ConnectionSt ring = Conn;
      db.Open();
      db.CreateParame ters(3);
      db.AddParameter s(0, "statusname ", statusname);
      db.AddParameter s(1, "statusdesc ", statusdesc);
      db.AddParameter s(2, "pk_autstatusid ", pk_autstatusid) ;
      int a = db.ExecuteNonQu ery(CommandType .StoredProcedur e, "EditStatus ");
      }

      over here wen i pass null value in statusdesc at that time the error comes....

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Originally posted by dharmeshsoni
        db.AddParameter s(1, "statusdesc ", statusdesc);
        db.AddParameter s(2, "pk_autstatusid ", pk_autstatusid) ;
        It looks like there are two AddParameters functions:

        AddParameters(i nt, string, string);
        AddParameters(i nt, string, int);

        Which one are you talking about?

        Also, what do you mean by null value in statusdec? statusdesc is a string object and string objects do not have null values.

        Comment

        Working...