Author |
Topic |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 31 January 2003 : 12:49:42
|
The red "if" statement in the block below does not execute. Is "rs(M_(whateverfield)) not set at this point of the programming, or what else do I need to do to call on it? quote: '## Forum_SQL - Delete the Member strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS_PENDING " strSql = strSql & " WHERE M_KEY = '" & key & "'"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Response.Write " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Your Registration Has Been Completed!</b></font></p>" & vbNewLine & _ " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>You may now begin posting" if strAuthType="db" then Response.Write(" using your new UserName and Password") Response.Write ".</font></p>" & vbNewLine & _ if rs("M_JOIN") <> "NO" then Response.write"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""club_welcome.asp""><b>Click here to go to Welcome Page!</font></a></p>" Response.Write("<meta http-equiv=""Refresh"" content=""5; URL=club_welcome.asp"">") else Response.write" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""default.asp""><b>Back to Forums</font></a></p>" end if end if rsKey.close set rsKey = nothing '#####################################################################################
|
Alfred The Battle Group CREDO
|
|
davemaxwell
Access 2000 Support Moderator
USA
3020 Posts |
Posted - 31 January 2003 : 13:04:02
|
I'm surprised you're not getting an error. Remove the & _ on the line before the if statement. |
Dave Maxwell Barbershop Harmony Freak |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 31 January 2003 : 14:07:35
|
Dave, I fixed that and now I get an error:quote: Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: 'rs' /bg/forums/register.asp, line 218
The "rs" means "record set", doesn't it? So, is this record not set now, and can it not be called on? I did include the field in the "INSERT" block: quote: strSql = strSql & ", M_COUNTRY" strSql = strSql & ", M_JOIN"
|
Alfred The Battle Group CREDO
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 31 January 2003 : 15:44:11
|
You mean if I do this then it would work?: quote: '## Forum_SQL - Delete the Member strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS_PENDING " strSql = strSql & " WHERE M_KEY = '" & key & "'"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Response.Write " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Your Registration Has Been Completed!</b></font></p>" & vbNewLine & _ " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>You may now begin posting" if strAuthType="db" then Response.Write(" using your new UserName and Password") strSql = "SELECT M_JOIN FROM " & strMemberTablePrefix & "MEMBERS " Response.Write ".</font></p>" & vbNewLine & _ if rs("M_JOIN") <> "NO" then Response.write"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""club_welcome.asp""><b>Click here to go to Welcome Page!</font></a></p>" Response.Write("<meta http-equiv=""Refresh"" content=""5; URL=club_welcome.asp"">") else Response.write" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""default.asp""><b>Back to Forums</font></a></p>" end if end if rsKey.close set rsKey = nothing
|
Alfred The Battle Group CREDO
|
Edited by - Alfred on 31 January 2003 15:45:14 |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 31 January 2003 : 15:50:47
|
won't work, because you haven't specified which member to return, nor have you actually openned the recordset, you've just written a sql statement and not executed it. |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 31 January 2003 : 16:49:20
|
Right. That is because all I can do is copy some instance where I find another "select". Unfortunately each instance of "select" that I can see in register.asp has different additional code with it, and I have no idea what to apply to my case.
If I would only find out the basic, generic way to make use of a data field I may have a chance. |
Alfred The Battle Group CREDO
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 31 January 2003 : 18:19:15
|
Yes, I was trying to get some wisdom out of the one you gave me a few days ago, but only found part of what I need under the subject SELECT.
Am I getting any closer with my wild guesses:quote: set my_Conn = Server.CreateObject("ADODB.Connection") my_Conn.Open strConnString strSql = "SELECT M_JOIN FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE M_NAME = '" & ChkString(Trim(Request.Form("Name")), "SQLString") &"'" set rs = my_Conn.Execute (strSql)
then I put the IF statement, and closed again with this:quote: rs.close set rs = nothing
A test run gave me this error, whatever that means:quote: Error Type: (0x80020009) Exception occurred. /bg/forums/register.asp, line 226
|
Alfred The Battle Group CREDO
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 31 January 2003 : 21:26:39
|
hard to tell why you are getting that error without looking at the whole code. if I had to guess, I'd say becaue you are reinitializing the my_Conn connection, which is already done on each page in inc_header |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 31 January 2003 : 23:22:55
|
What you are saying then is that what I wrote is actually looking correct, if it didn't repeat the "initializing"? Bingo, for me that would be like hitting the right number in a lottery!
Is this called "initializing": set my_Conn = Server.CreateObject("ADODB.Connection")
When I commented that line out I got this error:quote: Error Type: ADODB.Connection (0x800A0E79) Operation is not allowed when the object is open. /bg/forums/register.asp, line 220
... I thought since you had told me to open the record set - and that is the only thing I "opened"... |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 31 January 2003 23:38:03 |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 31 January 2003 : 23:39:38
|
that and then opening it.
Alfred..you're enthusiasm and determination to learn how to code in asp is admirable, but (please don't take this the wrong way) sometimes it seems like you are jumping in blindly, which you've already seen can cause some problems and may lead to improper coding, security risks, etc. I do strongly suggest you look at those sites to learn a bit more about asp and database connectivity. You'll need to spend some time working through articles, examples, etc., but in the long run it will pay off. Most everything I know about asp, I taught myself through sites like 4guysfromrolla. You might even want to set up a simpler database to play with as you learn how to retrieve recordsets, insert records, and delete records. You'll then have a much better understanding for the code that you see in Snitz. |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 01 February 2003 : 00:09:49
|
Well, I would call it more like being pushed in the water than jumping in blindly...
There is nothing I would love more than absorbing the skills step by step, with good tuition, rather than going through this incredibly frustrating blind guessing struggle.
I have bookmarked about a dozen sites over the months that claim "quick" and "easy" and "simple" tuition, and printed out half a book so I could study it without getting red-eyed. Invariably they take me into dead ends, either by non-intuitive terminology, or plain bad documentation.
I need to find something that explains it the way I explain something to a novice - putting myself into the other person's mind. Good instructing takes clear thinking, and careful attention to detail, and being a good teacher is a lot harder than being a good student.
YOU do a good job of it - whenever you are willing - and I am grateful for the help you have given me.
|
Alfred The Battle Group CREDO
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 03 February 2003 : 17:11:30
|
Alfred have you considered buying a good ASP book? I can advise Professional Active Server Pages 3.0, from Wrox. It works wonders, that's where I learned my ASP from. You need to spend 3 to 4 hours on the first 8 chapters as whole, since you already have a head start. You can always jump directly to the ADO chapters. It's wonderful to have as a reference.I keep it near me all the time. |
Snitz 3.4 Readme | Like the support? Support Snitz too |
Edited by - ruirib on 03 February 2003 17:12:36 |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 03 February 2003 : 19:45:55
|
Thanks for those tips! I will try and see where I can get it.
A reference is exactly what one needs if one has to do the work *now*, and doesn't have the luxury of leisurely learning. |
Alfred The Battle Group CREDO
|
|
|
|
Topic |
|