How to check if result of request to DB is empty?

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 12 04:43:36 PST 2015


On Saturday, 12 December 2015 at 12:36:10 UTC, Suliman wrote:
> On Saturday, 12 December 2015 at 12:14:30 UTC, Vadim Lopatin 
> wrote:
>> On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote:
>>> On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote:
>>>> On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote:
>>>>> Oh sorry! I used wrong host! All ok!
>>>>
>>>> Yes, there was issue with host name, but it's do not solve 
>>>> problem. Second DB have same fields and I still getting 
>>>> false instead moving into while loop
>>>
>>> It's look like it do `next` step before return something.
>>> So if in DB 1 value it will work like:
>>> do step
>>> if no value after it --> return false
>>> if yes --> return true
>>>
>>> but I need any way to check if first value in DB is exists. 
>>> Any suggestion?
>>
>> If you expect to have single or zero rows in result, use
>> if (rs.next()) {
>>             dbuser = rs.getString(1);
>>             dbpassword = rs.getString(2);
>>             writeln(dbuser);
>> } else {
>>             writeln("user not found");
>> }
>
> Do not help :( same result. It's return false :(

Ehm... it's seems that issue occur if I have few rs.next() call. 
I thought it's create new content every time. So I will try to 
look at my code again.


More information about the Digitalmars-d-learn mailing list