Ask a Question related to ASP Database, Design and Development.
-
Miranda johnsen #1
Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
Hello,
I am in desperate need of some help here.
I need to pass my username (uName) value from this authorization code to
my client page. When the clients username and password are authorized as
valid they are being sent to the client page with this line of code:
Response.write("<SCRIPT Language=JavaScript>window.location =
\"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
I am trying to attach the value with this:
clientnewstest1.asp?rmemeid=uName and its not working, I'm not
experienced with using queries ect.. and I cannot get the syntax right!
If anyone can help me with this I would greatly appreciate it. Thanks in
advance :+)
<%
var conn;
var rs;
var sSQL;
conn=Server.CreateObject("ADODB.Connection");
rs=Server.CreateObject("ADODB.Recordset");
conn.Open("cpWebdata");
sSQL = "SELECT InvestorAdmin.*";
sSQL += " FROM InvestorAdmin ";
sSQL += " WHERE MemberID = '" + Request.Form("uName") + "' ";
sSQL += " AND MemberPW = '" + Request.Form("uPass") + "';";
rs=Server.CreateObject("ADODB.Recordset");
rs.Open(sSQL, conn);
//Response.write(sSQL);
if (!rs.eof) {
var rmemeid;
rmemeid = rs("MemberID");
//Response.write(rmemeid);
//var memid;
//memid = Request.form("uName");
//Response.write(memid);
Response.write("<SCRIPT Language=JavaScript>window.location =
\"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
} else {
//Not a valid username or password
Response.write("<SCRIPT Language=JavaScript>window.location =
\"loginportfolio.asp\";</SCRIPT>");
rs.close();
conn.close();
rs=null;
conn=null;
}
%>
============================
Miranda Johnsen
[url]www.mirandajohnsen.com[/url]
===========================
"Every worthwhile accomplishment, big or little, has its stages of
drudgery and triumph; a beginning, a struggle and a victory."
Ghandi
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Miranda johnsen Guest
-
How to send files to client
Hi, Does anyone know how to send a file to the client from Flex. My scenario is this: 1) Pass some parameters to java layer 2) Java layer... -
Help Urgent, How to get hashed pwd in web service when send in username token as SendHashed
Hi, I am sending username and pwd in usernametoken in SendHashed format, While in web service, i am getting Nothing in that UsernameToken's... -
NT Client Username
> Does anyone know of a way of finding the client's username using PHP. Hi, The following server variables (like HTTP_REFERER) should help you:... -
Webservice over HTTPS. How to choose certicicate and send username nad password???
Webservice over HTTPS. How to choose certicicate and send username nad password??? Now i'm getting connection errors saying that the ssl... -
send page to client when session expires
A client-side timer fires and does the page redirect - you can't do it from global.asa since there is no page request context to redirect.with when... -
Aaron Bertrand - MVP #2
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
Uname, memid, rmemeid? I feel bad for anyone that has to inherit this
code...
Why do you need client-side JavaScript to do this? How about:> Response.write("<SCRIPT Language=JavaScript>window.location =
> \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
Response.Redirect('../clientside/clientnewstest1.asp?rmemeid=' +
Request.Form("uName"));
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
Aaron Bertrand - MVP Guest
-
Ray at #3
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
<%
Response.write("<SCRIPT Language=JavaScript>window.location =
'../clientside/clientnewstest1.asp?rmemeid=" + uName + "';</SCRIPT>");
%>
Or, to see it in a simpler way:
<%
var uName = Request.Form("uName");
var sHref="../clientside/clientnewstest1.asp?rmemeid="+uName;
Response.write("<script language=javascript>");
Response.write("window.location='" + sHref + "';");
Response.write("</script>");
%>
Ray at work
"Miranda johnsen" <info@mirandajohnsen.com> wrote in message
news:eqWeWvBwDHA.1740@TK2MSFTNGP12.phx.gbl...> Hello,
> I am in desperate need of some help here.
> I need to pass my username (uName) value from this authorization code to
> my client page. When the clients username and password are authorized as
> valid they are being sent to the client page with this line of code:
> Response.write("<SCRIPT Language=JavaScript>window.location =
> \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
>
> I am trying to attach the value with this:
> clientnewstest1.asp?rmemeid=uName and its not working, I'm not
> experienced with using queries ect.. and I cannot get the syntax right!
>
> If anyone can help me with this I would greatly appreciate it. Thanks in
> advance :+)
>
> <%
> var conn;
> var rs;
> var sSQL;
>
> conn=Server.CreateObject("ADODB.Connection");
> rs=Server.CreateObject("ADODB.Recordset");
> conn.Open("cpWebdata");
>
> sSQL = "SELECT InvestorAdmin.*";
> sSQL += " FROM InvestorAdmin ";
> sSQL += " WHERE MemberID = '" + Request.Form("uName") + "' ";
> sSQL += " AND MemberPW = '" + Request.Form("uPass") + "';";
>
>
> rs=Server.CreateObject("ADODB.Recordset");
> rs.Open(sSQL, conn);
> //Response.write(sSQL);
>
> if (!rs.eof) {
>
> var rmemeid;
> rmemeid = rs("MemberID");
> //Response.write(rmemeid);
> //var memid;
> //memid = Request.form("uName");
> //Response.write(memid);
> Response.write("<SCRIPT Language=JavaScript>window.location =
> \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
>
> } else {
> //Not a valid username or password
> Response.write("<SCRIPT Language=JavaScript>window.location =
> \"loginportfolio.asp\";</SCRIPT>");
>
>
> rs.close();
> conn.close();
> rs=null;
> conn=null;
> }
> %>
> ============================
> Miranda Johnsen
> [url]www.mirandajohnsen.com[/url]
> ===========================
> "Every worthwhile accomplishment, big or little, has its stages of
> drudgery and triumph; a beginning, a struggle and a victory."
> Ghandi
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Ray at Guest
-
Miranda johnsen #4
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
NEVER MIND - I FINALLY GOT IT :+)
..AFTER TRYING 10,000 DIFFERENT THINGS :+S
Miranda Johnsen
[url]www.mirandajohnsen.com[/url]
===========================
"Every worthwhile accomplishment, big or little, has its stages of
drudgery and triumph; a beginning, a struggle and a victory."
Ghandi
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Miranda johnsen Guest
-
Ray at #5
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
Well, that just further proves it then.
Every worthwhile accomplishment, big or little, has its stages of
drudgery and triumph; a beginning, a struggle and a victory."
Ray at work
"Miranda johnsen" <info@mirandajohnsen.com> wrote in message
news:e1mKULCwDHA.3536@tk2msftngp13.phx.gbl...> NEVER MIND - I FINALLY GOT IT :+)
> .AFTER TRYING 10,000 DIFFERENT THINGS :+S
>
> Miranda Johnsen
> [url]www.mirandajohnsen.com[/url]
> ===========================
> "Every worthwhile accomplishment, big or little, has its stages of
> drudgery and triumph; a beginning, a struggle and a victory."
> Ghandi
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Ray at Guest
-
Miranda johnsen #6
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
Hi Aaron, i know my variables were messy. I've cleaned them up and only
kept one as they were created during my madness. I was thinking
response.redirect, but could'nt find any examples.
I ended up with:
Response.write("<SCRIPT Language=JavaScript>window.location =
\"../clientside/mic1sharetransactions.asp?MemberID='" +
Request.Form("uName") + "'\";</SCRIPT>");
and then on the client page, grabbing it with:
var member_id;
member_id = Request.QueryString("MemberID");
sSQL = "SELECT *";
sSQL += " FROM MIC1Shares, Investors, InvestorAdmin";
sSQL += " WHERE InvestorAdmin.MemberID = " + member_id;
sSQL += " AND Investors.MemberID = " + member_id;
sSQL += " ORDER BY MIC1Shares.DateIssued DESC;";
Miranda Johnsen
[url]www.mirandajohnsen.com[/url]
===========================
"Every worthwhile accomplishment, big or little, has its stages of
drudgery and triumph; a beginning, a struggle and a victory."
Ghandi
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Miranda johnsen Guest
-
Aaron Bertrand - MVP #7
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
> Response.write("<SCRIPT Language=JavaScript>window.location =
Still don't understand why you're going to force JavaScript here. William
Tasso, for one, won't be able to use your site.
However, if you're going to insist on using client-side script, at least do
it right for possible future compatibility issues... window.location is not,
in and of itself, a property, so:
Response.write("<SCRIPT Language=JavaScript>window.location.href =
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
Aaron Bertrand - MVP Guest
-
Ray at #8
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:ejwnPaDwDHA.3144@tk2msftngp13.phx.gbl...
You're full of the old-post humor today. :]> Still don't understand why you're going to force JavaScript here. William
> Tasso, for one, won't be able to use your site.
Ray at work
Ray at Guest
-
Miranda johnsen #9
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
Thanks Ray!
I experienced an extra dose of drudgery and struggle with this one, but
victory sure made me dance :+P
Miranda Johnsen
[url]www.mirandajohnsen.com[/url]
===========================
"Every worthwhile accomplishment, big or little, has its stages of
drudgery and triumph; a beginning, a struggle and a victory."
Ghandi
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Miranda johnsen Guest
-
Miranda johnsen #10
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
Hi Aaron,
I am going to convert to Response.redirect :+)
I've run into another problem though:
One more question :+)
ok, so now I have my value passing. But, because I have so much data, I
want to break it up into different pages. So I need to create some links
that again pass the value.
=========== This is what I've done =====================
<%
var conn;
var rs;
var sSQL;
conn = Server.CreateObject("ADODB.connection");
conn.Open("cpWebdata");
var memid;
memid = Request.QueryString("MemberID");
sSQL = "SELECT *";
sSQL += " FROM MIC1Shares, Investors, InvestorAdmin";
sSQL += " WHERE Investors.MemberID = " + memid+";";
rs=Server.CreateObject("ADODB.Recordset");
rs.Open(sSQL,conn);
Response.write(sSQL);
%>
<a href=mic1shares.asp?MemberID=<%=rs("MemberID")%>'> Mic1 shares</a>
...etc
================== testpass.asp =========================
<%
var conn;
var rs;
var sSQL;
var memid;
memid = Request.QueryString("MemberID");
conn = Server.CreateObject("ADODB.connection");
conn.Open("cpWebdata");
sSQL = "SELECT *";
sSQL += " FROM MIC1Shares, Investors, InvestorAdmin";
sSQL += " WHERE InvestorAdmin.MemberID = " + memid;
sSQL += " AND Investors.MemberID = " + memid +";";
rs=Server.CreateObject("ADODB.Recordset");
rs.Open(sSQL,conn);
Response.write(sSQL);
Response.write(rs("InvestorName"));
%>
================================================== =
This is sent thru:
[url]http://localhost/clients/CooperPacific/www/clientside/testpass.asp?Membe[/url]
rID=CP00020
============== AND THIS IS THE ERROR i GET ============
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected
1.
/clients/CooperPacific/www/clientside/testpass.asp, line 182
================================================== =======
Thanks,
Miranda Johnsen
[url]www.mirandajohnsen.com[/url]
===========================
"Every worthwhile accomplishment, big or little, has its stages of
drudgery and triumph; a beginning, a struggle and a victory."
Ghandi
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Miranda johnsen Guest
-
Aaron Bertrand - MVP #11
Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)
> sSQL += " WHERE Investors.MemberID = " + memid+";";
Is MemberID text or numeric? If it's text, then you need to treat the
literal as a string. You can do this by surrounding it with single quotes.
sSQL += " WHERE Investors.MemberID = '" + memid+"';";
Otherwise, it looks like this:
.... WHERE Investors.MemberID = someTextValue
Which makes it think that someTextValue is a column name, and of course it
can't find that column in your table.
BTW if this is the case, then that's a poor name, IMHO -- ID usually implies
numeric data. Oh, and you'll want to prevent SQL injection attacks by
doubling up apostrophes within the string, e.g. try out
page.asp?memberID=o'toole
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
Aaron Bertrand - MVP Guest



Reply With Quote

