is there simple way convert tsql result json? mean is, input arbitrary sql , return me json of result set. note need in tsql.
sqlcommand sc = new sqlcommand("sp_visa_selectby_id", new conn().con) { commandtype = commandtype.storedprocedure }; sc.parameters.addwithvalue("@id", id); sqldatareader sdr = sc.executereader(); visa visa = new visa(); while (sdr.read()) { visa.id = sdr.getint32(0); visa.name = sdr.getstring(1); visa.desc = sdr.getstring(2); visa.date = sdr[3].tostring(); visa.agency_id = sdr.getint32(4); } javascriptserializer js = new javascriptserializer(); js.serialize(visa);
Comments
Post a Comment