|
| |
|
|
ThumperZA
Posts: 12 Joined: 6/21/2007 Status: offline
|
Default Values - 2/20/2009 5:56:25
I am trying to combine normal scripting and DRW to match a value already specified in the page with a value from the DB. A script collects the username from the login page and carries it throughout the site on every page which works fine. Now I want DRW to lookup the value of username within a table where the field is called agent but I dont seem to be getting the format right. SELECT * FROM PSADATA WHERE Agent='username' This brings no results, probably coz its looking for the exact phrase username, what is the correct format to collect an already predefined value ? For example I can display the value by using <%= username %> or response.write username
|
|
|
|
William Lee
Posts: 1273 Joined: 1/25/2002 From: Singapore Status: offline
|
RE: Default Values - 2/20/2009 7:31:49
quote:
SELECT * FROM PSADATA WHERE Agent='username' If using DRW, it should be SELECT * FROM PSADATA WHERE Agent='::username::'
_____________________________
William Lee pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ
|
|
|
|
ThumperZA
Posts: 12 Joined: 6/21/2007 Status: offline
|
RE: Default Values - 2/20/2009 7:52:39
I have tried that and still no records were returned. If I write for example: SELECT * FROM PSADATA WHERE Agent='Jermaine Wood' Then the correct recrds are selected Is there any way to test that ::username:: contains data if that makes sense. http://196.211.66.82/pmsadfb/test.asp
< Message edited by ThumperZA -- 2/20/2009 8:31:29 >
|
|
|
|
William Lee
Posts: 1273 Joined: 1/25/2002 From: Singapore Status: offline
|
RE: Default Values - 2/20/2009 9:21:25
How did you pass the value of username? I see your test page is also not displaying correctly when you response.write username. If it prints blanks, it means username is not passed correctly.
_____________________________
William Lee pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ
|
|
|
|
ThumperZA
Posts: 12 Joined: 6/21/2007 Status: offline
|
RE: Default Values - 2/23/2009 4:10:32
You wont see a username value because you have not provided a value (logged in). When I log in the username is displayed corerctly. My first post says: "For example I can display the value by using <%= username %> or response.write username " I wouldnt know if it was safe to post the login/username code here unfortunately.
|
|
|
|
William Lee
Posts: 1273 Joined: 1/25/2002 From: Singapore Status: offline
|
RE: Default Values - 2/23/2009 5:47:14
quote:
ORIGINAL: ThumperZA You wont see a username value because you have not provided a value (logged in). When I log in the username is displayed corerctly. My first post says: "For example I can display the value by using <%= username %> or response.write username " I wouldnt know if it was safe to post the login/username code here unfortunately. duh
_____________________________
William Lee pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ
|
|
|
|
ThumperZA
Posts: 12 Joined: 6/21/2007 Status: offline
|
RE: Default Values - 2/24/2009 0:21:18
Hi Spooky I get this error when verifying the query: Server error: Unable to retrieve schema information from the query: SELECT * FROM PSADATA WHERE Agent='"&Session("Username")&"'" against a database using the connection string DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/PSA.mdb. The following error message comes from the database driver software; it may appear in a different language depending on how the driver is configured. ------------------------------------------------------- [Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression 'Agent='"&Session("Username")&"'"'. Source: Microsoft OLE DB Provider for ODBC Drivers Number: -2147217900 (0x80040e14) I have also found out that the session is the userid, username has reference to: username = R("username") Please see image below. Results Image
< Message edited by ThumperZA -- 2/24/2009 1:00:01 >
|
|
|
|
ThumperZA
Posts: 12 Joined: 6/21/2007 Status: offline
|
RE: Default Values - 2/26/2009 0:32:31
I didnt have much luck getting this to work the "easier" way. For some reason the only way I could get this to work was to create a page before the DRW page that posted the username session to the DRW page by means of a hidden form field and a auto redirect. The value of the username session just never wanted to work in a sql statement. Although the statement is in the correct syntax. Thanks for the efforts.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|