Forums

This topic is locked

Variable in UPDATE fields String

Posted 27 Apr 2005 22:23:20
1
has voted
27 Apr 2005 22:23:20 summer westbrook posted:
OK. I'm sure there is something simple that is wrong here...any suggestions?
(ASP, SQL2K, VBSCRIPT)

What I'm trying to do is append the new Notes to the Old Notes in the database.

When I try to insert the variable "Notes" it inserts nothing (not NULL, just removes whatever was there and replaces it with nothing) DB column is nvarchar.

When I try and UPDATE with using just a regular textbox name it updates just fine, but i loose the old notes. When i try to use the variable is when it screws up.

Also, when I do just a Response.Write(Notes) without the update it writes out the string exactly as I want it too....

Form action is set to POST.

Any Suggestions? Here's part of the code:


If (CStr(Request("MM_update") = "form1" And CStr(Request("MM_recordId") <> "" Then

Dim OldNotes
Dim NewNotes
Dim Notes

OldNotes = Request.Form("OldNotes"
NewNotes = Request.Form("NewNotes"
Notes = (OldNotes & NewNotes)

MM_editConnection = MM_ssoteaminfo_STRING
MM_editTable = "dbo.ssoSupportform"
MM_editColumn = "ID"
MM_recordId = "'" + Request.Form("MM_recordId" + "'"
MM_editRedirectUrl = "ssoSupporttracking.asp"
MM_fieldsStr = "" + Notes + "|value"
MM_columnsStr = "SupportLog|',none,''"

Replies

Replied 04 May 2005 17:04:08
04 May 2005 17:04:08 Daniel Severns replied:
on the page before you update create a text box (or however you would like it formated) for each feild in the record. Even if it wont be updated. Then create a recordset based on whatever you will be updating and add your results to the value="<%=your_recordset.fields.Item("feild_name".Value%>" tag of each of those text boxes.

This will populate the text boxes with what is already in the table. When you perform the UPDATE command grab all the fields and update all of them instead of just one.

If that didnt make any sense or you need more instruction, let me know.



--------------------
MtnManDan

<!—I think, therefore I am. I think. - George Carlin
Replied 04 May 2005 19:01:13
04 May 2005 19:01:13 summer westbrook replied:
Thanks for the response.

I ended up just hand coding the update SQL statement...

I figured out through a series of well placed Response.Writes that the MM generated code was setting the value of my variable to just nothing...
so the update was working fine, just the variable value wasn't being gerated correctly.

Why? Don't have a clue...but a least it's working now.

Reply to this topic