使用Java脚本将数据插入SQL数据库 [英] Insert Data to SQL Database using Javascript

查看:103
本文介绍了使用Java脚本将数据插入SQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我创建了一个经典的ASP页面.我使用Java脚本从第三方应用程序捕获了一些数据.在这里,我想将该数据存储到sql数据库中.按下按钮后,所有值都应存储在数据库中.但是我不明白该怎么做.感谢任何人能帮助我.

这是我的ASP页面.

Hi,

I created a classic ASP page. I capture some data from the 3rd party application using java script. Here I want to store that data into the sql database. After press a button all the values should store in the database. But I can''t understand how to do it. Appreciate if any one can help me.

Here is my asp page.

<html>
<head>
<title>Test of disconnection</title>
<meta http-equiv="Content-Language" content="<%=language%>">
<meta http-equiv="Content-Type" content="<%=charset%>">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 

<style type="text/css">
<!--
    * { margin:0; padding:0; }
    h1 {
	font-family: "Trebuchet MS", sans-serif;
	font-size: 1.8em;
	letter-spacing: -1px;
	background-color: #3f5f91;
	color: white;
	padding: 7px;
	margin-bottom: 7px;
    }
-->

</style>

</head>
<body onLoad="connectExternal(); startClock();" bgcolor="#ffffff">
<div id="connected" style="display:none;">
<h1 style="color: #afa" >Call connected</h1>
</div>

<div id="QueueName" style="display:None;">
<h1 style="color: #afa"> OK </h1>
</div>

<div id="disconnected" style="display:none;">
<h1 style="color: #faa">Call disconnected!</h1>
<form>
<input type=submit name="Submit" value="Submit" onclick="--Save Record in Database--"></input>
  </form>
</div>

<div id="noconnection" style="display:none;">
<h1 style="color: #ffa">Opened not in Client, will not work</h1>
</div>


</body>

<script type="text/javascript" language="JavaScript">
<!-- 

var ActivePhoneCall;
var QueueName;
var LogonName = "<%=Server.URLEncode(Request.ServerVariables("LOGON_USER"))%>";

var handler = function(a1, a2, a3) {
	    alert('Ñïàñèáî!')
}

function connectExternal() {
  try {
    ActivePhoneCall = window.external.GetActivePhoneCall();
    if (ActivePhoneCall.CallState != 3) 
      document.getElementById("connected").style.display = 'block';
      AgentName=window.external.GetAgent();
      QueueName=window.external.GetActiveQueue();
      AgentID=AgentName.ID;
      AgentDisplayName=AgentName.DisplayName;
      AgentLoginName=AgentName.LoginName;
      CallType=ActivePhoneCall.Kind;
      CustomerID=ActivePhoneCall.ConnectedNumber; 
      Queue=QueueName.DisplayName; 
      alert(Queue);
      

      
  } catch(e) {
    ActivePhoneCall = null;
  }
}
//-->
</Script>



谢谢您,



Thank you,

推荐答案

使用传统的AJAX for ASP-XMLHttp或ServerXMLHTTP对象.

参考:
如何使用XMLHTTP或ServerXMLHTTP对象提交表单数据 [
Use traditional AJAX for ASP - XMLHttp or ServerXMLHTTP Object.

Refer:
How To Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object[^]


这篇关于使用Java脚本将数据插入SQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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