query sql to datable
query sql to datable
LG501
Posts: 2Questions: 1Answers: 0
Good afternoon, I have an adminlte integration, I want that from a datatable created by code in response to a query to some sql server tables and that result can be displayed on the screen by the datatable. I appreciate your help, I have been trying for a long time but I couldn't do it
Answers
I don't fully understand your requirements. You can use
ajax
to fetch the data and Datatables expects the response to be a JSON string. See the Ajax docs for details. Running examples are here.You can use jQuery ajax() to fetch the data then in the
success
function initialize Datatables and use thedata
option to populate the table.If this doesn't help then please provide more details of how you are fetching the data, the format/structure of the response and what you have tried with Datatables.
Kevin
Tnks kevin
I appreciate your time to answer me. When I do a query in my DB it brings me a result, I encapsulate that result in a table or datatable with all the records that the query brings.
I was looking at admin and the way it shows the results and its search, I find it fascinating, so I would like to show the results of my sql query in vb.net
but I can't find the way. I hope to be very explicit this time.
As Kevin says, you need JSON data to be returned by the server when DataTables makes a request to get the data to show. If you aren't sure how to get VB.NET to return JSON, you'll need to ask on StackOverflow, a VB.NET specific site, or work your way through some VB.NET tutorials. I'm afraid I don't know VB.NET and that is out of scope for the support we can provide on this forum.
Allan