I have a field in a dataset that I would like to run through a function and then add the result to the dataset before returning it to the sub.
Right now I am getting the dataset, putting the ZipCodes into an array and then getting my distance calc after the fact. This works ok but it would be far better to have included with the original dataset.
This is what I am doing now.
VB Code:
Dim getZip As String = txtZip.Text Dim getRad As Integer = RadioButtonList1.SelectedValue Dim myDS As DataSet = GetUE_ZipRadius(getZip, getRad) DataList1.DataSource = myDS DataList1.DataBind() With myDS.Tables("ZipCodes") Dim zipCodesA(.Rows.Count - 1) As String For i As Integer = 0 To .Rows.Count - 1 zipCodesA(i) = CStr(DirectCast(.Rows(i).Item("ueZip"), Integer)) LookUpZipCode(getZip, zipCodesA(i)) ListBox1.Items.Add(Format(CalcDistance(), "F").ToString) Next End With myDS.Dispose()
Is it possible to the (Format(CalcDistance(), "F").ToString) before hand and have the distances added as a column to the dataset?
Oh yea the dataset code looks like this
VB Code:
Dim LowLatitude As Double = iStartLat - LatRange Dim HighLatitude As Double = iStartLat + LatRange Dim LowLongitude As Double = iStartLon - LonRange Dim HighLongitude As Double = iStartLon + LonRange Dim strSelect2 As String = _ "Select ueStore, ueAddress, ueCity, ueState, " & _ "ueZip, uePhone From queUncEdsZCodes " & _ "Where Latitude <=" & HighLatitude & _ "And Latitude >=" & LowLatitude & _ "And Longitude <=" & HighLongitude & _ "And Longitude >=" & LowLongitude Dim Cmd2 As New OleDbDataAdapter(strSelect2, conn) Dim ds As New DataSet Cmd2.Fill(ds, "ZipCodes") Return ds




Reply With Quote