Link to home
Start Free TrialLog in
Avatar of Member_2_5230414
Member_2_5230414

asked on

If statment - if value does not = 0 and value dpes nto = 0

I am trying to add some value to my database only if but my values don't contain 0 (zero)

Currently my code looks like this

  If Convert.ToInt32(sessionh05.Split("/")(2)) <> "0" And Convert.ToInt32(sessiona05.Split("/")(2)) <> "0" Then
                    inserttodaysmatchesintodb(dv2.Row.Item("Kickofftime"), dv2.Row.Item("hometeam") & " V " & dv2.Row.Item("awayteam"), Session("hftover05"), Session("aftover05"), Session("vftover05"), Session("hftover15"), Session("aftover15"), Session("vftover15"), Session("hftover25"), Session("aftover25"), Session("vftover25"))
                End If

Open in new window


My issue is if only 1 of the values contain zero it does nto add it but it should be only if BOTH values contain zero.

I have performed an output to make sure i am getting value back using this code

    test123.text += "ht :" & sessionh05.Split("/")(2) & " at: " & Convert.ToInt32(sessiona05.Split("/")(2)) & "<br>"

Open in new window


And i get the following results

ht :0 at: 0
ht :0 at: 47
ht :0 at: 0
ht :0 at: 0
ht :23 at: 0
ht :0 at: 0
ht :0 at: 0
ht :0 at: 0

as you can see ht :0 at: 47 should be added and ht :23 at: 0 should be added but its not.

Can anyone help with my logic
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_5230414
Member_2_5230414

ASKER

It worked