Result of query not loading into component

Resolved
Alberto Nudman asked on July 9, 2016

Hi,
I am a newbie,
I have followed the instructions provided in http://www.flexmonster.com/doc/connecting-to-relational-database-with-net/
I have created an ASPX page (VisualizadosDatos.aspx) which queries the DB and returns the data through the compressor. If I paste the link into the browser, I see something like
"___ocsv2___2.215/2.213 +ejecutivo,+fecha_real_de_visita,+periodo_de_fecha_real_de_visita,+etapa,+unidad,+modelo,+tipologia,+medio Pablo Barria,16-04-2016 0:00:00,04-2016,Barrio Los Castaños Etapa 2,B,D-82 D,D,Referido ^0,10-04-2016 0:00:00,^0,Condominio Los Castaños %n%,C,C-74 C,C,Letrero ^0,^1,^0,^1,^1,^1,^1,^1 ^0,19-06-2016 0:00:00,06-2016,^0,^0,^0,^0,^1 ^0,18-05-2016 "
This shows the query contents are right. However, if I use the script and put filename: "localhost:/VisualizadorDatos" into the script, the component is shown but no data is displayed
Kindly help

4 answers

Public
Alberto Nudman July 10, 2016

Hi
I added the following line to my script:
dataSourceType: 'ocsv'
And now the grid loads the data... but most of the fields are empty. And the query IS returning the right data (if I run it in SQL Management Studio directly, I can see it)

Public
Alberto Nudman July 10, 2016

Hi again....
 
I have figured out what happens, though I don't know how to fix it. The OCSV loads fine, but with many empty rows. If I filter them, I can see the data correctly.
What should I do?
 

Public
Alberto Nudman July 10, 2016

Hi
Finally I figured out how to deal with this. Only adding Response.End() in the last part solved it all
Final code looks like this
protected void Page_Load(object sender, EventArgs e)
    {

        string resultado;

        string connectionString = "******";
        SqlConnection sqlConnection = new SqlConnection(connectionString);
        sqlConnection.Open();
        string query = "SELECT * FROM TABLE";
        DbCommand command = new SqlCommand(query, sqlConnection);
        DbDataReader reader = command.ExecuteReader();

        Stream inputStream = Flexmonster.Compressor.Compressor.CompressDb(reader);
        resultado = new StreamReader(inputStream).ReadToEnd();

        Response.Write(resultado);
        Response.End();
        
    }

Public
Ian Sadovy Ian Sadovy Flexmonster July 11, 2016

Hello Alberto,
 
I am glad to hear that the issue is resolved.
Please do not hesitate to contact us if you have any further questions.
 
Regards,
Ian

Please login or Register to Submit Answer