[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:
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:
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...
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.