Community of VE/MapPoint Users and Developers
This is a discussion on MapPoint 2006, SQL Server 2005 and C# within the MapPoint 2006 Discussion forums, part of the Map Forums category; Hello all, I just joined this community and hope you guys can help me. I started with MapPoint development two ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| MapPoint 2006, SQL Server 2005 and C# I just joined this community and hope you guys can help me. I started with MapPoint development two days ago and can't work it out. We use an SQL Server 2005 database with columns containing the zip code of the city in Germany and another with the profite for each of them. Now I am trying to write a C# program which should get the data from the database and then represent it using the MapPoint Winform. At this point I got all the needed values from the database but can't figure out how I could display them. I guess their format is wrong since it is not a dataset. I hope someone can help me with this. Thanks in advance |
| ||||
| Re: MapPoint 2006, SQL Server 2005 and C#
Do you want to post a snippet showing how far you have gotten with the code so far? How are you connecting to SQL? Eric
__________________ Order MapPoint 2006 | Read Programming MapPoint in .NET | Start Using the Pushpin Tool - Free Trial Download - click here. |
| |||
| Re: MapPoint 2006, SQL Server 2005 and C#
Hello all, my code is not very sophisticated I simply wrote a .net App and used the System.Data.SqlClient Namespace to save the query results as a string. This looks something like this: Code:
string status;
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=TEST;Integrated Security=SSPI; Asynchronous Processing=true");
string myQuery = "select postcode, contactid,lastname from customers";
SqlCommand command = new SqlCommand(myQuery, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
int counter = 0;
int[] ids = new int[100];
hashUmsatz.Clear();
hashPlz.Clear();
this.StatusLabel.Visible = true;
try
{
while (reader.Read() && counter < 100)
{
try
{
status = "Processing Postcodes: " + reader.GetString(0) + ", " + reader.GetInt32(1) + ", " + reader.GetString(2);
this.StatusLabel.Text = status;
this.StatusLabel.Refresh();
hashPlz.Add(reader.GetInt32(1), reader.GetString(0));
hashUmsatz.Add(reader.GetInt32(1), reader.GetString(2));
ids[counter] = reader.GetInt32(1);
}
catch (Exception)
{
Console.WriteLine("Datensatz fehlerhaft");
}
counter++;
}
}
finally
{
reader.Close();
connection.Close();
} Furthermore, another question came up: We want to include this feature into an exsiting product. Is it possible to use the application and the features without MapPoint installed? Best regards, Sebastian |
| ||||
| Re: MapPoint 2006, SQL Server 2005 and C#
I'm not great with C++, and I'm not sure actually what a hash is.. is it like an array? but if you have the Postcode in a string, you can map it.. take a look at the examples MapPoint help file. Start with the FindResults method.MapPoint *does* need to be installed.. there is an ActiveX control, but it still needs to be installed. Eric
__________________ Order MapPoint 2006 | Read Programming MapPoint in .NET | Start Using the Pushpin Tool - Free Trial Download - click here. |
| |||
| Re: MapPoint 2006, SQL Server 2005 and C#
Hello Eric, thanks for the fast reply. Actually the code should be C# and I am not very good at that I was trying to use a hash function to have a fast access to my data that I extracted from the SQL Database. Furthermore, the Hash table is dynamic. I got a unique customer number, the postcode and some fictional data about the sales. How would you organise this? Simply in a string or an array? I used an array so far and wanted to use the unique customer numbers as index...this didn't work out so well. Thank you very much for the help so far Best regards, Sebastian |
| ||||
| Re: MapPoint 2006, SQL Server 2005 and C#
Oh, I'm sorry, that is C#. And it says so in your subject line ![]() I don't have a suggestion about the hash or string or array, etc. but I'd recommend to try to get the simplest example or code snippet from the MapPoint help file working and then work backwards from there. Eric
__________________ Order MapPoint 2006 | Read Programming MapPoint in .NET | Start Using the Pushpin Tool - Free Trial Download - click here. |
| |||
| Re: MapPoint 2006, SQL Server 2005 and C#
Hello again, thanks to Eric I can successfully find locations on the map, but I am not sure how I can attach data to these locations. I read the numbers from a SQL database and got them saved within my source code. Another question I got is if it is possible to zoom in on a specific country. I now see Europe and I am just interested in Germany. Thanks in advance Sebastian |
| |||
| Re: MapPoint 2006, SQL Server 2005 and C#
Hi, ActiveMap has a Location property and that is the Location of the center of the screen. You can save latitude, longitude, altitude of it and set it again at startup of your application.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: MapPoint 2006, SQL Server 2005 and C#
Thanks Wilfried, I'll check that out first thing tomorrow. I tried further to get my data into a MapPoint.Dataset. I implemented the Dataset interface but i am not sure how to write the needed methods. I am getting the feeling that I missed something very big to do this. Furthermore, I had problems using the displaydatamap method because i didn't have all the parameters and didn't know what the are standing for. I hope someone can help. Thanks everyone so far. Regards Sebastian |
| ||||
| Re: MapPoint 2006, SQL Server 2005 and C#
I don't expect that what you want to do is that hard, do you have the option to hire or contract with some person to do it for you or write sample code for your specific situation? You can read the data into code, you can render your data, what is missing exactly? OTOH, the DisplayDataMap method *is* tricky.. personally, I have frequently referenced the book "Programming MapPoint in .NET" and the examples in there when I've had problems with the DisplayDataMap method... which seems to be every time I try to use it! ![]()
__________________ Order MapPoint 2006 | Read Programming MapPoint in .NET | Start Using the Pushpin Tool - Free Trial Download - click here. |
![]() |
| ||||
| Posted By | For | Type | Date | |
| MapPoint 2006, SQL Server 2005 and C# - MapPoint Forums | This thread | Refback | 03-21-2008 09:44 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Storing Latitude and Longitude in a SQL Server 2005 DB? | OOT | MapPoint 2006 Discussion | 2 | 11-01-2007 11:09 AM |
| Geocode your data directly from SQL Server 2005 | Johannes Kebeck's Blog | Virtual Earth Blogs | 0 | 09-15-2007 03:25 PM |
| can i use microsoft mappoint 2006 in asp.net 2005/c# ? | ssaraslm@gmail.com | MapPoint 2006 Discussion | 1 | 03-14-2007 01:27 PM |
| Map Point Location Server WSDL Errors in Visual Studio 2005 | insanek | MapPoint Web Service and Virtual Earth | 0 | 03-01-2007 03:52 PM |
| MapPoint 2005/6/7... | Anonymous | MapPoint 2006 Discussion | 1 | 09-07-2004 09:49 AM |
Cheap Flights to Benidorm
Book cheap flights to Benidorm with Holiday Hypermarket. Whether Summer or Winter Benidorm is a great destination.
Spain Holidays
Find and book Spain Holidays with Travel Counsellors. Holiday destinations around the world including Spain.
Turkey Holidays
Istanbul is Turkey's prime attraction as it has the most beautiful mosques and palaces of the country; it has Byzantine churches and Roman temples. Book Turkey Holidays online.
Dubai Holidays
Dubai holidays provide you with exotic sights, desert safaris and superb cuisine. There is an extensive range of things to do and see!
Cheap Portugal Holidays
Want to know what the best time to book cheap Portugal holidays is? Well have a look on ulookubook.com for some useful information to save your cash. Golf, tennis and cycling are all very popular here.
Travel
Check out the travel options on Travel.co.uk.
Cheap Goa Holidays
Experience the world famous Wednesday Flea Market at Anjuna! Book cheap Goa holidays at On The Beach!