This topic is locked

inner join and the view page

3/17/2005 12:44:20 AM
ASPRunnerPro General questions
P
PeterT author

Great Product!
I'm something of a SQL neophyte - so I'm sure I'm doing something wrong.... I've set up an inner join to pull data from a second table:
select order_id,

b.username as username,

status,

details,

storeid

From orders a

inner join users b on

a.member_id=b.member_id
works fine in list mode. However, when I try to view the same set of data, I get the error:
Error number -2147217900

Error description [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'username'.

URL /mgr/orders_view.asp

SQL query select [username], [order_id], [status], [details], [storeid] from [dbo].[orders] where [order_id]='21691BS0 '
Clearly, you are using a standard query for the view page. Why is the query that I defined used for the list page but not the view page?
BTW, I am updated to the 3.1a version. Thanks!

Sergey Kornilov admin 3/17/2005

Hi,
I would recommend to create a view in SQL Server on the top of this SQL query and use this view as a datasource in ASPRunnerPro.

P
PeterT author 3/17/2005

Hi,

I would recommend to create a view in SQL Server on the top of this SQL query and use this view as a datasource in ASPRunnerPro.



So, in general, you cannot do a custom SQL query and have the view page work?

Sergey Kornilov admin 3/23/2005

Peter,
theoretically you can modify ..._view.asp page to achieve this.
replace the following code snippet (will be different in your code):

strSQL="select " & AddWrappers("ID") & ", " & AddWrappers("Make") & ", " & AddWrappers("Model") & ", " & AddWrappers("YearOfMake") & ", " & AddWrappers("Picture") & ", " & AddWrappers("Horsepower") & ", " & AddWrappers("EPACity") & ", " & AddWrappers("EPAHighway") & ", " & AddWrappers("Price") & ", " & AddWrappers("Date Listed") & ", " & AddWrappers("Phone #") & ", " & AddWrappers("UserID") & ", "


with this one:

strSQL=gstrSQL