Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

odd result in multiple update

Status
Not open for further replies.

schase

Technical User
Sep 7, 2001
1,756
US
Hi all,

I have a multiple edit page displaying all of the records for a given month.

The user can edit one part or every record without problem
Except...

On two drop down box's, named txtSales1 & txtSales 2, I have the properties listed below. Now it will initially show the record it was inserted with perfectly fine, and the drop down will show all available choices to select.

However when I update it - the record will turn from like Dorchester, D to just D.

Is it the , that is doing it? any work around at all?

Thank you.

<select name=&quot;txtSales1&quot; class=&quot;inputbox&quot;>
<option value=&quot;<%=rsResults(&quot;fldSales1&quot;)%>&quot; selected><%=rsResults(&quot;fldSales1&quot;)%></option>
<%
While (NOT rsSales.EOF)
%>
<option value=&quot;<%=(rsSales.Fields.Item(&quot;fldSalesName&quot;).Value)%>&quot; ><%=(rsSales.Fields.Item(&quot;fldSalesName&quot;).Value)%></option>
<%
rsSales.MoveNext()
Wend
If (rsSales.CursorType > 0) Then
rsSales.MoveFirst
Else
rsSales.Requery
End If
%>
</select> &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Stuart

Have you posted the form/querystring to the screen and verified that the value for that dropdown is fully &quot;Dorchester&quot;, and not &quot;D&quot;. Response.write reqest.form will do it.

If it is fully displayed, then the issue is with the inserting into your recordset. If not fully displayed, the issue is with the form.

Reveal the answer, and show the code for that side. If it is the form side, also post the finished client side html.

Dam those torpedos! Jonathan Galpin
 
lol yeah,

Actually yesterday I redid the entire set of pages over to pass a numerica id versus the name. Was a big rework, but I did find out that the comma is the problem.

(resolving it was a different story).

What it would do is go up to say Dorchester and stop, sometimes it would just show the D, and sometimes it would show all.

If I removed the comma and went with a space, it'd insert perfectly fine.

If I can find a work around on the comma would be very cool. I have a recordset pulling off of it's value. &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
If the string is &quot;Dorchester, D&quot; then changing from an insert statement to a direct update will do the trick.

I believe the comma iterferes with the insert statement. There is an url encode function you can use, but you may need to decode it each time you pull it out.

For a direct update, open the record directly, with a write cursor:

ie &quot;select all where pkCustomerID = '234567'&quot;

'open recordset with write cursor code here
'then
rs(&quot;customer_abbreviated_name&quot;) = request.form(&quot;that_input_name&quot;)
rs.update
'code to close rs here.

I have a little data access code at that could be helpful under objects.

Jonathan Jonathan Galpin
 
Hey Jonathan,

Thanks for your reply,

I'm pretty curious at this point - I have done a solution by referencing the ID number instead of the name. But my curosity is wondering about it still.

I had used an update command before on it. It pretty much sounds like the url encode was the method to do it - or javascript to strip out the comma. &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Actually, proper programming practice entails using the id. All relationships between tables should be hinted at using a key naming convention such as:

Table Customer
pkCustomerID [primary key]
FName
LName

Table Transcation
pkTransactionId
fkCustomerID [foreign key]
fkStoreID
transDate
... etc

There is a good reason for this....computers are faster with numbers!

And [Main Reason number Two] this format reduces duplication. In the old days, the customer info would be included in each transaction. The entire transaction would migrate from currentTransaction to completedTransaction etc.

The urlencode functions [server.urlencode] go hand in hand with a function I have somewhere called makeSQLSafe, also for encoding. Life is far easier not using these. Use only if you have to.

Torpedo Shields UP!
Jonathan Galpin
 
lol roger that

Thanks again. &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top