How can i read data from my Datatable filled with a dataset from sql server to a Datatables.

How can i read data from my Datatable filled with a dataset from sql server to a Datatables.

allabs4lmpallabs4lmp Posts: 2Questions: 1Answers: 0

I have been able to integrate datatables to my website.

Also created headers for the table

Coop. Number Staff Name ID Card Number Department Phone Email Edit Delete

This is the code that fetches vaues from the sql server into my dataset then to my datatabe

ds = DALCooperators.MCS_Cooperators_Fetch()
dtable = ds.Tables(0)

What is left is the synchronzation between my datatable and the Datatables to display the rows and columns

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794
    edited August 2017 Answer ✓

    First you need to make sure your data structure is correct. This page discusses the supported structures and gives examples of how to provide the data during Datatables initialization.
    https://datatables.net/manual/data/

    Or you can use rows.add() followed by draw() to display the data after Datatables has been initialized.

    Kevin

  • allabs4lmpallabs4lmp Posts: 2Questions: 1Answers: 0

    Thanks Kthorngren. I found that very helpful.

    I have populated my Datatables with data from my sql server.

    Please I need to save whatever changes made on the datatable to my server.

    PLease how can I go about it.

    THanks

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    The easiest way is to use the DataTables Editor. It is well worth the small cost of a developer license. There is a trial period to allow you to evaluate.

    Otherwise you will need to write your own Javascript code to handle the updates based on your specific requirements.

    Kevin

This discussion has been closed.