Author |
Topic |
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 09 March 2004 : 19:10:26
|
I've added another text field to the Topics Table with this DBS:
[ALTER]
TOPICS
ADD#LOCATION#memo#NULL#
[END]
[ALTER]
A_TOPICS
ADD#LOCATION#memo#NULL#
[END]
I'm trying to get the field to pass through post.asp and post_info.asp and I need some help please.
This is some of my code in post.asp:
'######## Location Field ########
Response.Write " </tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Located :</b></font></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """><input type ""text"" maxLength=""25"" name=""Location"" value="""" size=""25"" ONSUBMIT=""sstoreCaret(this);""></td>" & vbNewLine & _
" </tr>" & vbNewLine
'################################ What I would like is for this field to display the location if it already contains text. I know it is something like Value = chkstring(rsLocation, display).
I'm really stuck from here on in too with post_info.asp.
I've modified the code and so far I get the following error: Wrong number of arguments or invalid property assignment: 'Chkstring'
/post_info_loc.asp, line 1004
Here's my test forum: www.stephendoyle.net U: snitz P: snitz
Here are text versions of my 2 files: www.stephendoyle.net/post_loc.txt www.stephendoyle.net/post_info_loc.txt
If you use this forum link for testing please: http://www.stephendoyle.net/post_loc.asp?method=Topic&FORUM_ID=50
You can see where I want the end result to be displayed - on my custom page www.stephendoyle.net/hl_equipment2.asp
Once again, all help would be sincerely appreciated.
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 March 2004 : 01:02:26
|
OK, I've nearly got it. I can pass it through post_info.asp now. I just need the data to show in the field when I edit a post.
New txt file posted. www.stephendoyle.net/post_info_loc.txt
Any ideas? |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 March 2004 : 01:07:19
|
Correction - it works for new topics but fails when editing current topics: Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 3: Incorrect syntax near '='.
/post_info_loc.asp, line 632
|
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 10 March 2004 : 02:49:09
|
I just tried it, and it seemed to work fine for me. No errors and I changed from the tick, to the hammer to the cross and no problems.. |
Cheers, David Greening |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 10 March 2004 : 03:19:03
|
you need to make sure you have added your new field in the correct position when issuing your query, ASP/ADO can be very fussy about where and how you reference memo fields in a query, they should be the LAST fields in your select statement, you must then assign them to variables in the same order they appear in your select statement.
What are you adding the new field for ? I would strongly advise against adding extra memo fields to your topic tables, far better to add an Integer key and link to seperate table |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 March 2004 : 05:38:48
|
David - did you try entering text in the Location field?
Huwr - your option sounds good. I've got a custom page www.stephendoyle.net/hl_equipment2.asp that I am using to show loan equipment status and location. Yeah, I don't think I've got the code right at all. Can you please have a look at my txt file above for post_info_loc.asp?
Cheers. |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 March 2004 : 17:16:26
|
I think I've nearly got it. Once it's finally working I'll look at creating a new table for this info and linking it back to the Topics table as per Huwr's suggestion. Right now I've got a syntax error on the following line:
strSql = strSql & ", 1 "
strSQL = strSQL & ", 0 "
strSQL = strSQL & ", 0 "
strSql = strSql & ", " & Request.Form("strLocation")
strSql = strSql & ", " & cLng(Request.Form("strMessageIcon"))
strSql = strSql & ", '" & dateHolder & "'"
Can anyone see the error? I've tried putting a cLng( ) around the Request.Form but that didn't work. |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 March 2004 : 18:39:43
|
If you are testing, please change post.asp to post_loc.asp in your address bar as this one points to post_info_loc.asp. Then follow the 'equipment' link in the header to see the field .. although posting won't work at the moment because of the above syntax error. |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 11 March 2004 : 07:47:38
|
In post_info for "EditTopic" try replacing this line
strSql = strSql & " SET LOCATION = '" & Request.Form("strLocation") with this
strSql = strSql & ", LOCATION = '" & txtLocation & "'"
In "Topic" you need to remove the line in red
strSql = strSql & ", 1 "
strSQL = strSQL & ", 0 "
strSQL = strSQL & ", 0 "
strSql = strSql & ", " & Request.Form("strLocation")
strSql = strSql & ", " & cLng(Request.Form("strMessageIcon"))
strSql = strSql & ", '" & dateHolder & "'"
You have it in the values twice.
And for your first question add "location" as the value.
'######## Location Field ########
Response.Write " </tr>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Located :</b></font></td>" & vbNewLine & _
" <td bgColor=""" & strPopUpTableColor & """><input type ""text"" maxLength=""25"" name=""Location"" value=""" & trim(CleanCode("location")) & """ size=""25"" ONSUBMIT=""sstoreCaret(this);""></td>" & vbNewLine & _
" </tr>" & vbNewLine
'################################ And like HuwR said, you want to declare your variables in the same order they are listed in the Select Sql.
|
_-/Cripto9t\-_ |
Edited by - cripto9t on 11 March 2004 08:35:44 |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 11 March 2004 : 17:42:11
|
Thanks Cripto9t, that works perfect!! |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 11 March 2004 : 18:03:01
|
Actually the last bit ... is there a way to have the field show the current Set Location rather than just text saying 'location' when editing the original topic? |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 12 March 2004 : 07:20:44
|
Oops .
Remove the parenthesis around "location" to get the variable you declared after the sql near the top of the page. If you rename that variable, you'll need to rename it here also.
value=""" & trim(CleanCode(location)) & """ With the parenthesis it's just plain text.
Also, you shouldn't need the CleanCode Function unless you're going to enable forum code on this field. value=""" & trim(location) & """
|
_-/Cripto9t\-_ |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 12 March 2004 : 18:07:29
|
Thanks Cripto9t, that did the trick. Now that it is working I'll have a look at Huwr's suggestion to move it out of the Topics table into a new table. |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 13 March 2004 : 18:53:52
|
Following on from Huwr's suggestion for putting this field in a seperate table is this the correct DBS for deleting my original change to the Topics tables (in my first post)?
[ALTER]
TOPICS
DROP#LOCATION###
[END]
[ALTER]
A_TOPICS
DROP#LOCATION###
[END] Would this be the correct DBS to add in the new table? I've also got some ideas for other fields on custom display pages.
[CREATE]
SDTOPICS
MEMBER_ID#int##
CAT_ID#int##
FORUM_ID#int##
TOPIC_ID#int##
SDTOPICS_LOCATION#memo#Perth Office#
SDTOPICS_TARGDATE#varchar(50)#NULL#
[END]
|
Edited by - StephenD on 13 March 2004 18:55:54 |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 13 March 2004 : 19:05:44
|
Actually I'll probably need to change the field: SDTOPICS_LOCATION#memo#Perth Office# toSDTOPICS_LOCATION#memo#NULL# and then do something likeSET#SDTOPICS_LOCATION#memo#Perth Office#
WHERE#F.FORUM_ID>=50 AND F.FORUM_ID<=66
Is my syntax correct?
|
|
|
|
Topic |
|