View Single Post

  #3 (permalink)  
Old 03-28-2008
devnait devnait is offline
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
Reply With Quote