how can i use the datatable with a view from sql server ?
how can i use the datatable with a view from sql server ?
Andreina95
Posts: 6Questions: 1Answers: 0
i need to visualize a view from sql server, but when i use a code that i find in this page (dhttps://datatables.net/development/server-side/php_mssql_odbc) i obtain the following error
This discussion has been closed.
Answers
Are you converting the SQL Server recordset into JSON format? Here's some sample code that I use, in VBScript. Not very elegant but it works. In the for loop you need a line for each field in the recordset. My recordset has 6 fields so it's array elements 0 through 5.
Did you follow the instructions in the tech note the error message links to? If so, what is the server returning given that its not valid JSON?
Allan
hi, i already past that problem but now i can't filter and use the pagination of the datatable, you have any idea ? how cant i resolve this problem...
this is my code:
The script you linked to is a legacy one (which is noted at the top of the page). Have you placed DataTables' server-side processing into legacy mode? Details for that are available here.
Allan
in my code (javascript) is that's how I have it
It doesn't look like you've enabled the legacy server-side processing. In which case it is sending parameters that your server-side script isn't expecting.
You need to either:
Allan
i don't understand , i see the example i don't see any difference with my code
That is exactly why Allan advised you to update your server-side script to use the new parameters.
Otherwise you have to follow Allan's alternative advice to use legacy parameters in your own code.
Sorry, I am new in this, i always work with mysql, so far I test the datatable with sql and I don't know exactly how it works with sql server
With mysql never gave me these kind of problems
Add this line:
before you initialise DataTables.
That will cause DataTables to send the legacy parameters to the server (required for that script since it uses the legacy parameters).
Allan
good