如何使用javascript从SQL Server数据库中检索数据? [英] How to retrieve data from SQL server database using javascript?

查看:99
本文介绍了如何使用javascript从SQL Server数据库中检索数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有



在我输入学生ID时使用ASP.Net webform的费用付款表格中,应该检索学生姓名并显示在学生历史表,以便操作员确认学生ID和学生姓名是同一个学生。



为了完成这个如何写一个javascript函数来检索适当的信息,因为学生ID在asp.net中输入,然后按回车。





问候



Amy



我的尝试:



我想通过在更改或其他事件上使用Javascript来完成此任务。我没有想法如何使用javascript检索信息所以请帮助我

Dear All

In the Fee Payment form using ASP.Net webform when I enter student id, the student name should be retrieved and displayed in the display filed from student history table so that Operator confirm that the student ID and the student name are the same student.

in order to accomplish this how to write a javascript function that retrieve the appropriate information as the student id is entered in the asp.net next and hit enter.


Regards

Amy

What I have tried:

I want to accomplish this task by using Javascript on change or some other event. I don't have Idea how to retrieve information using javascript so please help me

推荐答案

简单。出于很多原因,你没有。



然而,它可以与Web服务器通信并调用应用程序控制器公开的方法来操作数据,包括为您查询SQL Server并将数据返回到客户端上的javascript代码的方法。



谷歌的javascript调用控制器方法示例。
Simple. You don't, for a long list of reasons.

It CAN, however, talk to the web server and call methods exposed by the application Controllers to manipulate data, including having methods that query the SQL Server for you and return the data to your javascript code on the client.

Google for "javascript call controller method" for examples.


首先,您需要一个适用于所有浏览器的界面。话虽这么说,ActiveXObject()方法已经出局(仅限IE)。



    但更重要的是:

  • 您公开披露有关您服务器的信息
  • 你允许修改(有害)SQL的页面重复
First, you want an interface that is going to work across all browsers. That being said, ActiveXObject() methods are out (IE, only).

    But much more importantly:
  • you are publicly exposing information about your server
  • you are allowing for a duplicate of your page with modified (harmful) SQL


这篇关于如何使用javascript从SQL Server数据库中检索数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆