Orroland
asked on
MySQL / ASP - Invalid use of Null
I am getting an "invalid use of null" error with the following code.
cottage_array = split((enquiries.Fields.It em("enquir ycottage") .Value),", ")
There is definitely a value in the column.
If I do this instead I don't get the error:
dim str_enq : str_enq = (enquiries.Fields.Item("en quirycotta ge").Value )
cottage_array = split(str_enq,",")
I am using MySQL 5.1.
Any ideas..?
cottage_array = split((enquiries.Fields.It
There is definitely a value in the column.
If I do this instead I don't get the error:
dim str_enq : str_enq = (enquiries.Fields.Item("en
cottage_array = split(str_enq,",")
I am using MySQL 5.1.
Any ideas..?
otherwise:
dim v
v = ""
if not isnull(enquiries.Fields.Item("enquirycottage").Value) then
v = enquiries.Fields.Item("enquirycottage").Value
end if
cottage_array = split(v,",")
ASKER
Thanks for the amazingly fast response.
Yes, I see that this workaround will fix the problem. However, I don't understand why it is happening. The field is a MySQL text field and DEFINITELY has a value.
If have just found that even if I do a response.write of the field value before the split() it works. It seems that I need to extract the field value before it will work.
Yes, I see that this workaround will fix the problem. However, I don't understand why it is happening. The field is a MySQL text field and DEFINITELY has a value.
If have just found that even if I do a response.write of the field value before the split() it works. It seems that I need to extract the field value before it will work.
text field, you say? which size?
via odbc driver? which version?
that could be the problem... with the newest mysql odbc driver, or better the oledb provider, it should work better.
via odbc driver? which version?
that could be the problem... with the newest mysql odbc driver, or better the oledb provider, it should work better.
ASKER
My connection string:
driver={MySQL ODBC 5.1 Driver};server=xxx;uid=xxx ; pwd=xxx;database=xxx;optio n=3;
How do I use the OLEDB provider?
driver={MySQL ODBC 5.1 Driver};server=xxx;uid=xxx
How do I use the OLEDB provider?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, I have downloaded, installed and activated their Provider.
I now just get a (very unhelpful) error when I try to open a recordset:
800410ff
My new connection string is:
Provider=MySQL Provider; Data Source=xxx; User ID =xxx; Password=xxx; Initial Catalog=xxx;
Does this look OK?
I now just get a (very unhelpful) error when I try to open a recordset:
800410ff
My new connection string is:
Provider=MySQL Provider; Data Source=xxx; User ID =xxx; Password=xxx; Initial Catalog=xxx;
Does this look OK?
I seem to recall an error with Oracle readers that once you read the value, you cant read it again, hence a null.
you might store it to a local variable then split it. hence you dont' get the error
you might store it to a local variable then split it. hence you dont' get the error
this might work as shortcut:
Open in new window