SQL Query against Database instance in .NET
SQL Query against Database instance in .NET
beerygaz
Posts: 16Questions: 9Answers: 0
I'd like to execute a simple SQL query using the Datatables libraries in .NET (without returning an Editor). Much like this example in PHP https://datatables.net/forums/discussion/31952/raw-sql-query-for-editor
Does anyone have a simple example to get me started please? I'm really not sure how to go about constructing and executing my query.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You will basically only need this if you want to use the Editor database handler. If you don't need to use it there is no need for this because you can use your own. In some instances it might be advisable to use Editor's database handler because you might run into troubles with concurring updates using Editor and your own db handler at the same time.
Here are some examples for using Editor's raw method (sorry this is PHP but it should work very similarly in .NET). Just take a look at the docs. As you can see I commented out the "raw" database insert because Editor provides a much simpler insert method that also takes care of binding.
Here is the link to the .NET docs:
https://editor.datatables.net/docs/1.7.3/net/html/a23fa4f7-6e80-19f5-e5b0-49e0e7a50c88.htm
The
Database.Sql
method is the one you want here:Allan