Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi, Visual Basic 6; mysql = ( select something from table )

which will return some columns with some 'NULL's . Expected, no problem.

My If mysql(index) = NULL then else end if.

FAILS all the time.

Am I having a stupid moment?

I can get this to work:

if mysql(index) = "" then else end if

this seems to work, but I can not test on the "null" word. Have I looked at it too many hours? SMILE

asked 07 May '12, 17:32

George's gravatar image

accept rate: 0%

Use VB IsNull() method. i.e.,

dim rs as ADODB.recordset

set rs=new adodb.recordset {mysql}
do while not rs.EOF
    if IsNull( rs.Field(1).value) then ...

permanent link

answered 07 May '12, 21:56

Chris%20Keating's gravatar image

Chris Keating
accept rate: 31%

edited 07 May '12, 22:21

I was concerned that null in sybase was different then in MS SQL, the statements do not work the same. I will try the IsNull. Starting at 6am and going until my eyes and brain give out.... is not good any more. thanks I will do it this way. I don't know why I could not see it. SMILE Again thanks

(07 May '12, 22:31) George

If IsNull(myRSTM(8)) Then Else Me.txtCustomerName = myRSTM(8) End If Works; I am reading a single record and filing out text boxes only. For some reason me.txtValue fails when the field is null. Even Dim string fails. Same code for MS SQL, that is what way throwning me. I don't now this voting thing, your IsNUll fixed it.

(07 May '12, 22:39) George
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 07 May '12, 17:32

question was seen: 10,601 times

last updated: 07 May '12, 22:39