-1
SqlCommand command = new SqlCommand(queryString, connection);
command.ExecuteReader();

I want to get json object which has "PackageID","PackageNumber","StatusName" from this sqlCommand.How can I do it?

Gaz
  • 11
  • 1
  • 5
  • Possible duplicate of http://stackoverflow.com/questions/5083709/convert-from-sqldatareader-to-json – Varun K Aug 11 '13 at 13:46

1 Answers1

0

You can create an class that has the properties that you required. E.g.

class Package{
    public string PackageID{get;set;}
    public int PackageNumber{get;set;}
    public string StatusName{get;set;}
}

Assign this object with reader, then use some JSON library to serialize the object to JSON object.

Patrick
  • 1,717
  • 7
  • 21
  • 28
Eric
  • 1
  • 1