in my JS file I need to do a search on the DB (select * from table where condition) and store the result in an array(multidimensional) do you have an idea how to do it ? thank you in advance
Asked
Active
Viewed 1,345 times
0
-
check this link--http://stackoverflow.com/questions/13899650/is-it-possible-to-retrieve-data-from-sql-server-using-jquery – Animesh Apr 30 '14 at 08:16
-
1Write SQL in a Javascript is bad idea. You should use Ajax to send data to server. Then server file will execute the appropriate SQL. Then Server file will response your output. – Sajitha Rathnayake Apr 30 '14 at 09:17
2 Answers
2
the best solution is to use the dataSource files using the <customSQL>
tag , here is an example:
<operationBindings>
<operationBinding operationType="fetch">
<customSQL>
SELECT Name, Adress, Phone, Age
FROM tableName
where Age >20
</customSQL>
</operationBinding>
</operationBindings>

SBarney
- 39
- 1
- 1
- 11
1
Don't write any code in your JavaScript
related to Database
.
In Smart GWT
always access database using DataSource
You can use GWT JSNI to call Java method from JavaScript and vice-verse.
Find a sample code on Calling GWT Java function from JavaScript
-
I never suggest you to use it but still you can look at [Is it possible to retrieve data from SQL Server using jQuery?](http://stackoverflow.com/questions/13899650/is-it-possible-to-retrieve-data-from-sql-server-using-jquery?lq=1) – Braj Apr 30 '14 at 10:20