jorkin / aspjson

Automatically exported from code.google.com/p/aspjson
0 stars 0 forks source link

double quotation mark missing when using QueryToJSON #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. executing : QueryToJSON(dbconn, "SELECT name, surname FROM members WHERE age 
< 30").Flush

into an asp page

my own select is actually :
Select CategoryID as id, Description as value from Categories WHERE Description 
Like '%a%'

What is the expected output? What do you see instead?
The json data generated is :
[{"id":1,"value":"Soft drinks, coffees, teas, beers, and 
ales"},{"id":2,"value":"Sweet and savory sauces, relishes, spreads, and 
seasonings"},{"id":3,"value":"Desserts, candies, and sweet 
breads"},{"id":5,"value":"Breads, crackers, pasta, and 
cereal"},{"id":6,"value":"Prepared meats"},{"id":7,"value":"Dried fruit and 
bean curd"},{"id":8,"value":"Seaweed and fish"}]

The formatted json data gives 1 for the id value, instead of "1", so the double 
quotation mark is missing
What version of the product are you using? On what operating system?

w2003r2, IIS5, sql2K
with :
<!--#INCLUDE VIRTUAL="includes/JSON_2.0.4.asp"-->
<!--#INCLUDE VIRTUAL="includes/JSON_UTIL_0.1.1.asp"-->

Please provide any additional information below.

see source3.asp attached the script use the database is sample database 
'Northwind' provided by ms-sql 2k

delaunay@free.fr

Original issue reported on code.google.com by philippe...@gmail.com on 25 Aug 2012 at 2:12

Attachments:

GoogleCodeExporter commented 9 years ago
This is not bug. aspjson libary handles field with own datatype. you may use 
convert field to varchar on sql like following line.

QueryToJSON(dbconn, "SELECT CONVERT(VARCHAR, id), name, surname FROM members 
WHERE age < 30").Flush

Original comment by tugrulto...@gmail.com on 25 Aug 2012 at 2:34

GoogleCodeExporter commented 9 years ago
Issue 26 has been merged into this issue.

Original comment by tugrulto...@gmail.com on 10 Sep 2012 at 11:24