Hi @Scott Huang
First I studied your code ideas based on your previous cases. Your idea is to read out Currency_code data from the database and save it in a datarow. Then you use dataRow.Field ("<string>Currency_code") to save the "Currency_code" in the datarow as a variable of type string. Finally, it is saved for use in the Currency class.
using (SqlCommand sqlCmd = new SqlCommand("SELECT ...", sqlConn))
Currency_code = dataRow.Field<string>("Currency_code"),
The Field method on the DataRow class casts a DataTable cell to a specific type.
Best Regards
Qi You
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.