A module recently used in the company's project. Connect to a local database through the Baidu map API. The marked points in the displayed Baidu map are all records saved in the local database.
As I just graduated, I work as an ASP engineer in my company. NET is only half a year old, so the language expression and organization are not as smooth as the predecessors, and it is the younger brother's first blog. Please give me more advice.
First, create a database table. Because it is only a small test case, only three fields are used. The Point field stores the latitude and longitude, and the Title field stores the name of the mark Point.
Next, add a page. On the add page, you can obtain the longitude and latitude of the map based on the entered name and address. Then, you can access the database to save the information and latitude and longitude of the mark point in the data table.
<Html> $ (). Value = LocalSearch = cc = $ (). val () + $ (item = (I =; I <item. getNumPois (); I ++ LocalResultPoi = document. getElementById (). value = document. getElementById (). value + LocalResultPoi. point. lng ++ LocalResultPoi. point. lat + </script>
The back-end database access code uses a simple three-tier architecture.
Button2_Click(= = = = =
After performing the preceding steps and running, you can enter the tag points you want to save in the text box of the page name and address. Then, click the latitude and longitude query button to display the latitude and longitude of the marked point in the text box below. Click the Add button to add the data. The key to querying Baidu map API is longitude and latitude. Therefore, obtaining the longitude and latitude and adding them to the database are the key to finding out the corresponding points.
Then we need to associate the query page with the database just now, and mark the mark point on the Baidu map on the page.
<% @ Page Language = AutoEventWireup = CodeBehind = Inherits = %> <! DOCTYPE html PUBLIC>
= = = = MP.GetList( ).Tables[ point = marker = map = opts = infoWindow = addEventListener = ( i = ; i < da.Rows.Count; i+++= + da.Rows[i][] + += + i + + i + += + i + += + i + + da.Rows[i][] + += + i + + da.Rows[i][] + + i + += + i + + i + Point =); sb.Append(); sb.Append(); sb.Append( + Point + ); sb.Append(); sb.Append(); sb.Append(); sb.Append(
Concatenates strings in a loop. Obtain the longitude and latitude of the database to use the Baidu map API.
If you are not good at expressing all this in words, let the Code represent my heart.