Results 1 to 2 of 2

Thread: [2005] ASP.NET - Help With SQL Queries

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question [2005] ASP.NET - Help With SQL Queries

    Hi All,

    I've generated some SQL Queries using the Query Builder in Access but I am having problems implementing them into the webpage:

    Statement 1: - Returns No Records

    vb Code:
    1. sql="SELECT [Audit.ChangeNo], [Audit.ID], [Audit.Name], [Groups.Groups] & [Audit.Position] AS Officer, [Audit.FDate], [Audit.TDate], [Audit.Reason], [Audit.Email], [Audit.UserName], [Audit.IP], [Audit.LDate] FROM [Audit] INNER JOIN [Groups] ON (Audit.Group) = (Groups.GroupID) WHERE (((Audit.ID)= " & fldUsername.Text & ") AND ((Audit.FDate) >= " & SelectedFDate & ") AND ((Audit.TDate) <= " & SelectedTDate & ")) ORDER BY [Audit.ChangeNo] ASC;"

    Statement 2: - Problem With Join

    vb Code:
    1. sql="SELECT [Audit.ChangeNO], [Audit.ID], [Departments.Departments], [Groups.Groups] & [Audit.Position] AS Officer, [Audit.FDate], [Audit.TDate], [Audit.Reason], [Audit.Email], [Audit.Username], [Audit.IP], [Audit.LDate] FROM (Departments INNER JOIN Groups ON Department.ID=Groups.ID) INNER JOIN (Audit ON Audit.Group = Groups.GroupID) AND (Departments.ID = Audit.Department) WHERE [Audit.FDate] = '" & SelectedDate & "' AND (((Audit.ChangeNo)=(SELECT MAX(Audit.ChangeNo) FROM Audit WHERE (Audit.ID = Staff.ID)))) ORDER BY Audit.ChangeNo DESC;"

    Any suggestions or links to converting them to be compatible within a webpage would be great...

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] ASP.NET - Help With SQL Queries

    Statement1 - Place a breakpoint on that line. Step through the code, when that breakpoint hits, press F10. Then look at the value of 'sql' and try running that against your database to see if it's a valid query or what's different about it from what you generated

    Statement2 - We are not psychic, so "Problem with Join" does not actually help us in any way to understand your problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width