使用javascript插入SQL数据库表? [英] Insert into SQL database table using javascript ?
本文介绍了使用javascript插入SQL数据库表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
如何使用javascript代码从我的asp页面插入sql数据库表
i在表格中找到代码,我该怎么改变
i尝试从文本框中插入lat和lng以及名称从提示中读取google api
我尝试过:
hi
how can i insert into sql database table from my asp page using javascript code
i found code in select from table , what should i change
i try to insert lat and lng and name from textbox read from prompt google api
What I have tried:
google.maps.event.addListener(map, "rightclick", function(event) {
var lat = event.latLng.lat();
var lng = event.latLng.lng();
//window.prompt("Lat=" + lat + "; Lng=" + lng,"defaultText");
var text = prompt("Lat=" + lat + "; Lng=" + lng, "");
var objConnection = new ActiveXObject("adodb.connection");
var strConn = "driver={sql server};server=.;database=MAPDB;uid=sa;password=123456";
objConnection.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
var strQuery = "insert into tbl_hotarea (HeadTitle , lat , lng) values ('"+text+"' , '"+lat+"' , '"+lng+"')";
rs.Open(strQuery, objConnection);
});
推荐答案
您需要了解Web paq的工作原理。如果这完全有效,它将使用ActiveX插入您假定存在的客户端计算机上的数据库。
我希望你没有使用ASP。即使ASP.NET已经过时了。
您需要进行AJAX调用或回发并在后端代码中插入数据库
You need to learn how web paqes work. If this works at all, it will use ActiveX to insert into a database on the client machine that you assume exists.
I hope you're not using ASP. Even ASP.NET is outdated.
You need to make an AJAX call or a postback and insert to the database in the back end code
这篇关于使用javascript插入SQL数据库表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文