none
TableAdapter updatemethod parameter weirdness RRS feed

  • Question

  •  

    Hi everyone.

     

    I was wondering if someone has encountered the same thing that I've stumbled upon a couple of days ago... The case in itself is and should be quite straightforward. I have a DataSet ("ExampleDS"), with a couple of DataTables (let's discuss only "ExampleTable").

     

    The "ExampleTable" is used to update a DateTime field in the database table. The code for the op follows :

     

    internal bool SetNewOrderNotificationSentDate(string idNumber)
    {            
        ExampleDSTableAdapters.ExampleTableTableAdapter setExampleTable =        

        ExampleDSTableAdapters.ExampleTableTableAdapter();

        bool result = false;

     

        try
        {    
           setExampleTable.Update(idNumber, DateTime.Now);
           result = true;
        }
        catch (Exception ex)
        {
           throw new Exception("Error while updating the database", ex);
        }

     

        return result;
    }

     

    Simple as that, and it works fine. And now for the funky weirdness part that really is driving me nuts... It works in only in my environment. Not in my colleagues. For some reason, the update method changes the order of the paramaters it takes, when the project is run in another environment.

     

    i.e. in my environment the following works just as it should:

     

    setExampleTable.Update(idNumber, DateTime.Now);

     

    in my collegues environment it doesn't. The parameters have to be switched, hence

     

    setExampleTable.Update(DateTime.Now, idNumber);

     

    Huh? Can someone explain what is or might be happening here? Any help whatsoever would be greatly appreachiated. I must admit I'm a bit perplexed about this behaviour. In fact, I'm a bit worried about this as I've been using DataTableAdapters quite extensively until now and haven't encountered this kind of anomaly before.

     

     

    Thursday, January 17, 2008 11:11 AM

Answers

  • Hi,

     

    The first thought that comes to me is that you don't have the same code. Open the designer of the typed dataset and check out the definition of the “Update” method, or select the method and press “F12” to view the source code of the method. They cannot be the same.

     

    Best Regards

    Chunsheng Tang

    Monday, January 21, 2008 6:08 AM