MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




MapPoint 2006, SQL Server 2005 and C#

This is a discussion on MapPoint 2006, SQL Server 2005 and C# within the MapPoint 2006/2009 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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 03-20-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 11
MapPoint 2006, SQL Server 2005 and C#

Hello all,

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 03-20-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,222
Blog Entries: 1
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 03-28-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 11
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();
 
}
I got the feeling that it is not possible to map my data, i got from the database and saved as a string, onto the MapPoint map.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 03-28-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,222
Blog Entries: 1
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 03-28-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 11
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 03-28-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,222
Blog Entries: 1
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 04-01-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 11
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 04-02-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,034
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 04-03-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 11
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 04-03-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,222
Blog Entries: 1
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/mappoint-2006-sql-server-2005-c-7335.html

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Storing Latitude and Longitude in a SQL Server 2005 DB? OOT MapPoint 2006/2009 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/2009 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/2009 Discussion 1 09-07-2004 09:49 AM


All times are GMT -5. The time now is 01:32 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5
MP2K Magazine
Visitor Map

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!


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52