Getting Exception “not all code path return a value”

前端 未结 3 986
春和景丽
春和景丽 2021-01-22 00:34

Hi I have a method which updates a MySQL table using a query. I\'m using a MS Visual Studio and phpmyadmin as the SQL client.

Method:

public static Memb         


        
3条回答
  •  佛祖请我去吃肉
    2021-01-22 01:06

    Commonly, we need't return object like Member when update/insert or delete. We should return just a Boolean flag or return Nothing.

    If you return flag, you should set it as result of cmd.ExecuteNonQuery() > 0 and also in Catch brand.

    If you return nothing, just modify your method to

    public static void updateMember(...)
    {
        ....
    }
    

提交回复
热议问题