I have made progress with this. Although there is still more work to do like making my query dynamic, the concept is done. Here is the code I used. It will fill a DataGridView first when display data is clicked. Then you can choose to add a selected item or all items to the maps as notes. Here is the code. Hope it helps.Imports System.Data.SqlClient
Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms
Imports ESRI.ArcGISExplorer
Imports ESRI.ArcGISExplorer.Application
Imports ESRI.ArcGISExplorer.Geometry
Imports ESRI.ArcGISExplorer.Mapping
Imports ESRI.ArcGISExplorer.Data
Imports ESRI.ArcGISExplorer.Threading
Public Class Form1
' Initialize constants for connecting to the database
' and displaying a connection error to the user.
Protected Const SqlConnectionString As String = _
"Server=Your Server Name;" & _
"DataBase=YourDBName;" & _
"Integrated Security=SSPI"
Protected Const ConnectionErrorMessage As String = _
"To run this sample, you must have SQL " & _
"installed. For " & _
"instructions on installing SQL, view the documentation file."
Protected didPreviouslyConnect As Boolean = False
Protected didCreateTable As Boolean = False
Protected connectionString As String = SqlConnectionString
#Region "Display data"
' Handles the click event for the Display button. This handler gets the product
' information from the Contact table puts it into a DataSet which is used to
' bind to a DataGrid for display. Custom style objects are used to give the
' DataGrid a nice appearance.
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
If IsNothing(DataGridView1.DataSource) Then
Dim strSQL As String = _
"USE YourDBName" & vbCrLf & _
"SELECT * " & _
"FROM dbo.tblGIS"
Try
' The SqlConnection class allows you to communicate with SQL Server.
' The constructor accepts a connection string as an argument. This
' connection string uses Integrated Security, which means that you
' must have a login in SQL Server, or be part of the Administrators
' group for this to work.
Dim dbConnection As New SqlConnection(connectionString)
' A SqlCommand object is used to execute the SQL commands.
Dim cmd As New SqlCommand(strSQL, dbConnection)
' The SqlDataAdapter is responsible for using a SqlCommand object to
' fill a DataSet.
Dim da As New SqlDataAdapter(cmd)
Dim sqlData As New DataSet()
da.Fill(sqlData, "Data")
With Me.DataGridView1
.Visible = True
.AutoGenerateColumns = False
.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender
.BackColor = Color.WhiteSmoke
.ForeColor = Color.MidnightBlue
.CellBorderStyle = DataGridViewCellBorderStyle.None
.ColumnHeadersDefaultCellStyle.Font = New Font("Tahoma", 8.0!, FontStyle.Bold)
.ColumnHeadersDefaultCellStyle.BackColor = Color.MidnightBlue
.ColumnHeadersDefaultCellStyle.ForeColor = Color.WhiteSmoke
.DefaultCellStyle.ForeColor = Color.MidnightBlue
.DefaultCellStyle.BackColor = Color.WhiteSmoke
End With
Me.DataGridView1.DataSource = sqlData.Tables(0)
Dim newColumn As Integer = Me.DataGridView1.Columns.Add("ID", "ID")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "ID"
newColumn = Me.DataGridView1.Columns.Add("Name", "Name")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "Name"
newColumn = Me.DataGridView1.Columns.Add("Address", "Address")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "Address"
newColumn = Me.DataGridView1.Columns.Add("City", "City")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "City"
newColumn = Me.DataGridView1.Columns.Add("State", "State")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "State"
newColumn = Me.DataGridView1.Columns.Add("Zip", "Zip")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "Zip"
newColumn = Me.DataGridView1.Columns.Add("X", "X")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "X"
newColumn = Me.DataGridView1.Columns.Add("Y", "Y")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "Y"
newColumn = Me.DataGridView1.Columns.Add("Geog", "Geog")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "Geog"
newColumn = Me.DataGridView1.Columns.Add("Data1", "Data1")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "Data1"
newColumn = Me.DataGridView1.Columns.Add("Data2", "Data2")
Me.DataGridView1.Columns(newColumn).DataPropertyName = "Data2"
Catch sqlExc As SqlException
MessageBox.Show(sqlExc.ToString, "SQL Exception Error!", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End Sub
#End Region
#Region "Create Layer"
'Add all the elements of the table to the map as notes in a notes folder.
Sub btnAddNotes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNotes.Click
Dim mapDisp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
'create a folder
Dim fold As New Folder("SQL Notes")
mapDisp.Map.ChildItems.Add(fold)
'get coordinates of 1st selected record
Dim strX As String = Me.DataGridView1.SelectedRows(0).Cells("X").Value
Dim strY As String = Me.DataGridView1.SelectedRows(0).Cells("Y").Value
Dim strName As String = Me.DataGridView1.SelectedRows(0).Cells("Name").Value
Dim point As ESRI.ArcGISExplorer.Geometry.Point = ESRI.ArcGISExplorer.Geometry.Point.CreateFromLatitudeLongitude(strX, strY)
Dim note As New ESRI.ArcGISExplorer.Mapping.Note(strName, point, ESRI.ArcGISExplorer.Mapping.Symbol.Marker.Pushpin.Blue)
fold.ChildItems.Add(note)
End Sub
Sub btnAddAllNotes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddAllNotes.Click
Dim mapDisp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
'create a folder
Dim fold As New Folder("SQL Notes")
mapDisp.Map.ChildItems.Add(fold)
For Each dgvr As DataGridViewRow In DataGridView1.Rows
Dim strX As String = dgvr.Cells("X").Value
Dim strY As String = dgvr.Cells("Y").Value
Dim strName As String = dgvr.Cells("Name").Value
Dim point As ESRI.ArcGISExplorer.Geometry.Point = ESRI.ArcGISExplorer.Geometry.Point.CreateFromLatitudeLongitude(strX, strY)
Dim note As New ESRI.ArcGISExplorer.Mapping.Note(strName, point, ESRI.ArcGISExplorer.Mapping.Symbol.Marker.Pushpin.Blue)
fold.ChildItems.Add(note)
Next
End Sub
#End Region
Private Sub exitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitToolStripMenuItem.Click
Me.Close()
End Sub
End Class