I am connecting to a database with this query -
myCMD.commandtext = "select customer_reviews.meta_title, customer_reviews.meta_description from customer_reviews inner join customers on customer_reviews.customer_id = customers.id where customers.id = ? limit 1" myCMD.Parameters.Append myCMD.CreateParameter("@customerID", adInteger, adParamInput, 10, request("customer")) set myRS = myCMD.execute
I then have this code:
if Not isNULL(myRS("meta_title")) or myRS("meta_title") <> "" Then page_meta_title = myRS("meta_title") end if
if Not isNULL(myRS("meta_description")) or myRS("meta_description") <> "" Then page_meta_description = myRS("meta_description") end if
Both fields have a string value. The parameter page_meta_title was populating fine, but page_meta_description was always returning an empty string - when I know it was not empty.
After looking at the database, I noticed that the first field was of type varChar with the second was of Text. I changed the Text datatype to varchar and it worked, returning a value to the parameter.
If my debugging is correct, does a field of type Text not work with isNULL?
It turned out when if I first added this -
myMetaTitle = myRS("meta_title").value
myMetaDescription = myRS("meta_description").value
myKeywords = myRS("meta_keywords").value
Then ran my conditional statements it worked regardless of varchar or text field
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.