Handling ExecuteScalar() when no results are returned

后端 未结 22 1081
猫巷女王i
猫巷女王i 2020-11-27 05:47

I am using the following SQL query and the ExecuteScalar() method to fetch data from an Oracle database:

sql = \"select username from usermst wh         


        
22条回答
  •  清酒与你
    2020-11-27 06:08

    Try this

    sql = "select username from usermst where userid=2"
    
    string getusername = Convert.ToString(command.ExecuteScalar());
    

提交回复
热议问题