简体   繁体   English

从Microsoft SQL Server数据库向JavaScript函数发送数据的最佳方法

[英]The best way to send data to JavaScript functions from a Microsoft SQL Server Database

I have a bunch of location data (longitude and latitude pairs) sitting in a Microsoft SQL Server DB. 我在Microsoft SQL Server数据库中有一堆位置数据(经度和纬度对)。

I need to plot those points on a Map (OpenLayers+OSM), and the only way to draw on the map is to use JavaScript. 我需要在地图(OpenLayers + OSM)上绘制这些点,并且在地图上绘制的唯一方法是使用JavaScript。

So far, I have no idea how to achieve this goal. 到目前为止,我还不知道如何实现这一目标。 The only thing I know is that I do not want to establish a database connection in JavaScript. 我唯一知道的是我不想在JavaScript中建立数据库连接。 In other words, I need to somehow use c# to pass the data from database to Javascript. 换句话说,我需要以某种方式使用c#将数据从数据库传递到Javascript。 Any suggestions? 有什么建议么? All help is appreciated! 感谢所有帮助!

Write a asp.net generic handler page that fetches the data from the database and outputs a json string. 编写一个asp.net通用处理程序页面,该页面从数据库中获取数据并输出json字符串。

Then with jQuery parse that output and plot. 然后使用jQuery解析该输出并进行绘图。

You can make use of WebMethods and JQuery here. 您可以在此处使用WebMethods和JQuery。

Following blog post with an example should give you an idea how you can easily reach the server side code from client side : 在博客文章后附上一个示例,可以使您了解如何轻松地从客户端访问服务器端代码:

http://tugberkugurlu.com/archive/asp-net-web-forms---calling-web-service-page-methods-using-jquery http://tugberkugurlu.com/archive/asp-net-web-forms---calling-web-service-page-methods-using-jquery

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将数据从Excel文件导出到SQL Server数据库的最佳方法 - Best way to export data from an Excel file to SQL server database 从数据库加载SQL Server表记录并通过WCF调用发送记录的最佳方法 - Best way to load SQL Server table records from the Database and send them via a WCF call 从一个DataBase(sql server 2008)到具有不同架构的另一个db(sql server 2008)的传输数据的最佳方式 - The Best Way For Transfer Data From One DataBase (sql server 2008) To Another db(sql server 2008) With Different Schema 将 Microsoft SQL 数据库迁移/转换为 MongoDB 数据库的最佳方式? - Best way for migrating/converting Microsoft SQL Database to MongoDB Database? 从 Microsoft Word 中提取数据的最佳方法 - Best way to extract data from Microsoft Word 将SQL数据库的行传递给Javascript的最佳方法? - The best way to pass rows of an SQL Database to Javascript? 在SQL Server中存储大数据的最佳方法 - Best way to store large data in SQL Server 从SQL Server数据库中获取大量数据的最快方法 - Fastest way to fetch huge amount of data from SQL Server database 有没有办法将数据从Excel工作表导入SQL Server数据库? - Is there a way to import data from an excel sheet into a SQL Server database? 使用C#Restful Web服务从Microsoft SQL Server数据库检索数据 - Retrieving data from Microsoft SQL Server Database with C# Restful web service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM