onedizzydevil
Programmer
I have the following function in asp.net:
Public Function getAddresses(ByVal addresser As String) As DataSet
Dim sql As New SqlConnection(ConfigurationSettings.AppSettings("sql"
)
Dim com As New SqlCommand( _
" SELECT a.addresser, a.addressee, i.username AS addressername, b.username AS addresseename" & _
" FROM Portal.dbo.AddressBook a" & _
" INNER JOIN AuthenticationManager.dbo.worker w ON a.addresser = w.WID" & _
" INNER JOIN AuthenticationManager.dbo.worker x ON a.addressee = x.WID" & _
" INNER JOIN AuthenticationManager.dbo.individual i ON w.INo = i.IID" & _
" INNER JOIN AuthenticationManager.dbo.individual b ON x.INo = b.IID" & _
" WHERE a.addresser = 'D39F6B49-3A0A-4D5A-AB3D-9275F782854F'" & _
" ORDER BY addresseename", sql)
com.Parameters.Add("@addresser", addresser)
Dim adapter As New SqlDataAdapter(com)
Dim dst As New DataSet()
Try
sql.Open()
adapter.Fill(dst)
Return dst
Catch
Throw
Finally
sql.Close()
End Try
End Function
The query works fine in the Enterprise Manager but when I use it in the function nothing shows in the datagrid. Any idea why it does not work and a work around.
Wayne Sellars
"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."
Public Function getAddresses(ByVal addresser As String) As DataSet
Dim sql As New SqlConnection(ConfigurationSettings.AppSettings("sql"
Dim com As New SqlCommand( _
" SELECT a.addresser, a.addressee, i.username AS addressername, b.username AS addresseename" & _
" FROM Portal.dbo.AddressBook a" & _
" INNER JOIN AuthenticationManager.dbo.worker w ON a.addresser = w.WID" & _
" INNER JOIN AuthenticationManager.dbo.worker x ON a.addressee = x.WID" & _
" INNER JOIN AuthenticationManager.dbo.individual i ON w.INo = i.IID" & _
" INNER JOIN AuthenticationManager.dbo.individual b ON x.INo = b.IID" & _
" WHERE a.addresser = 'D39F6B49-3A0A-4D5A-AB3D-9275F782854F'" & _
" ORDER BY addresseename", sql)
com.Parameters.Add("@addresser", addresser)
Dim adapter As New SqlDataAdapter(com)
Dim dst As New DataSet()
Try
sql.Open()
adapter.Fill(dst)
Return dst
Catch
Throw
Finally
sql.Close()
End Try
End Function
The query works fine in the Enterprise Manager but when I use it in the function nothing shows in the datagrid. Any idea why it does not work and a work around.
Wayne Sellars
"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."