Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any idea on why this Query is not working...

Status
Not open for further replies.

onedizzydevil

Programmer
Mar 24, 2001
103
US
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."
 
Nevermind! ID-10-T errors. The work on 'Return' is a very important statement is code.



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."
 
Nevermind! ID-10-T errors. The keyword 'Return' is a very important statement in code. I was calling this from another function and forgot to Return the results.



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."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top