Как проверить, нет ли в результате ExecuteScalar()
данных?Проверка, если это ничего, не работает.
Мой код:
Dim cmdCode As New OracleCommand
cmdCode.Connection = sgcnn
cmdCode.CommandText = "select max(SUBSTR(client_code,4,7)) from CLIENT_INFO where (client_code Like '%' || :SysUser || '%') "
cmdCode.Parameters.Add("@SysUser", OracleDbType.Varchar2).Value = strMessage
'Dim sqlResult As Object = cmdCode.ExecuteScalar()
'If sqlResult Is Nothing Then
' ' No result found
' strMessage.Append("0001")
' txtClientCode.Text = strMessage.ToString
'Else
' 'result found
' Dim newProdID As Int32 = 0
' newProdID = Convert.ToInt32(cmdCode.ExecuteScalar())
' newProdID = newProdID + 1
' strMessage.Append(newProdID.ToString("0000"))
' txtClientCode.Text = strMessage.ToString
'End If