How do I find out if a column exists in a VB.Net DataRow

后端 未结 4 1012
暖寄归人
暖寄归人 2021-02-01 00:44

I am reading an XML file into a DataSet and need to get the data out of the DataSet. Since it is a user-editable config file the fields may or may not be there. To handle missin

4条回答
  •  鱼传尺愫
    2021-02-01 01:14

    You can encapsulate your block of code with a try ... catch statement, and when you run your code, if the column doesn't exist it will throw an exception. You can then figure out what specific exception it throws and have it handle that specific exception in a different way if you so desire, such as returning "Column Not Found".

提交回复
热议问题