通过百度地图API获取坐标并将数据存储在数据库内。

这篇博客介绍了如何通过百度地图API获取坐标,并将这些数据存储到SQL Server数据库中。作者提供了一个default.aspx.cs的示例代码,演示了如何在网页中调用API并进行数据库交互,鼓励读者根据自己的数据库需求建立相应的公共类。
摘要由CSDN通过智能技术生成

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

网上很多都是通过百度地图API调用JS的例子,并没有真正的数据库交互哦~所以我做了一个与sql server数据库交互的例子。数据库用的是sql server,大家看着自行建立数据库哦~~

 

首先,我们建立一个default.aspx

 
 
   
  1 <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>  2   3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  4   5 <html xmlns="http://www.w3.org/1999/xhtml" >  6 <head runat="server">  7     <title></title>  8     <style type ="text/css" >  9         table {
      10             border: solid 1px #999; 11         } 12      13     </style> 14     <style type="text/css"> 15     html,body{
     margin:0;padding:0;} 16     .iw_poi_title {
     color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap} 17     .iw_poi_content {
     font:12px arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word} 18         .auto-style1 {
      19             width: 87px; 20             height: 27px; 21         } 22         .auto-style2 {
      23             width: 417px; 24             height: 27px; 25         } 26     </style> 27     <script type="text/javascript" src="http://api.map.baidu.com/api?key=46ce9d0614bf7aefe0ba562f8cf8719&v=1.1&services=true"></script> 28  29     <script type ="text/javascript" > 30     function getAddr() 31     {
      32    var map=document.getElementById ("dituContent"); 33    if(map.style.display=="none") 34    {
      35    map.style.display="block"; 36    initMap(); 37  } 38  if(map.style.display!="none") 39  {
      40  initMap(); 41  } 42  43     } 44     </script> 45 </head> 46 <body style ="font-size :12px"> 47     <form id="form1" runat="server"> 48   <div> 49  经:<asp:TextBox ID="lng" runat="server"  style="" Width="108px"  ></asp:TextBox> 50   纬:<asp:TextBox ID="lat" runat="server" Width="102px" ></asp:TextBox> 51   <div style =" float :left "> 52         <table style="width: 600px; height: 327px; "> 53             <tr> 54                 <td style="width: 87px"> 55                     名称:</td> 56                 <td style="width: 417px"> 57                     <asp:TextBox ID="name" runat="server"></asp:TextBox> 58                     <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="name" 59                         ErrorMessage="公司名称不能为空!" Font-Size="Small"></asp:RequiredFieldValidator></td> 60                  61             </tr> 62             <tr> 63                 <td class="auto-style1"> 64                     城市:</td> 65                 <td class="auto-style2"> 66                     <asp:DropDownList ID="city" runat="server"> 67                     <asp:ListItem Value ="北京">北京<
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值