Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 6th, 2004, 03:55 PM
Authorized User
 
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update adds a preceeding space

When I update data in an access database, all the text fields get a space added to the begining of the entry (all of the fields that are included in the SQL Update that is). If I edit the field again I get another space added to the field preceeding the data. The number type fields do not appear to be affected. I am using the command object and the code is below.

Thanks



adCmdText = 1

'Start building the SQL string
sql33 = "UPDATE tblEquipment SET tblEquipment.Location = '" & Request.Form("Location") & "', "
sql33 = sql33 & " tblEquipment.Type = '"&Request.Form("Type")&"', "
sql33 = sql33 & " tblEquipment.SerialNumber = '" & Request.Form("SerialNumber") & "', "
sql33 = sql33 & " tblEquipment.Specs = '" & Request.Form("Specs") & "', "
sql33 = sql33 & " tblEquipment.MEDate = '" & Request.Form("MEDate") & "', "
sql33 = sql33 & " tblEquipment.TypeCode = '" & Request.Form("TypeCode") & "', "
sql33 = sql33 & " tblEquipment.Model = '" & Request.Form("Model") & "' "
sql33 = sql33 & " WHERE tblEquipment.MEID = " & Request.Form("MEID") & ";"


Set oConn33 = Server.CreateObject("ADODB.Connection")'Open Connection
oConn33.Open strConnect

'Create the command object
    Set oCmd33 = Server.CreateObject("ADODB.Command")

'Set the command object properties
    Set oCmd33.ActiveConnection = oConn33
    oCmd33.CommandText = sql33
    oCmd33.CommandType = adCmdText

    'Execute the command
    oCmd33.Execute
 
Old April 7th, 2004, 06:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am not sure, why you get a space preceeded as your code looks good. I would suggest you to test it out using TRIM function every where you a request.form().

for example: replace it this way.

Trim(Request.Form("Specs"))

Otherwise it is just a guess, may be you can check you Form controls html code to see whether you have put something like

<input type="text" value=" ">

If so you can make that empty by changing value="".

Cheers!

-Vijay G
 
Old April 7th, 2004, 10:29 AM
Authorized User
 
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks
It was in the previous Form. For some unexplained reason I put spaces in each of the form Values Between the " and the <%.


Equipment Type Code <Input Type="Text" Name="TypeCode" Value=" <%Response.Write strTypeCode%>">


SHOULD BE

Equipment Type Code <Input Type="Text" Name="TypeCode" Value="<%Response.Write strTypeCode%>">

Dale





Similar Threads
Thread Thread Starter Forum Replies Last Post
F5 (Refresh) adds a new record after postback krainov BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 November 20th, 2007 10:10 AM
Create Dynamic Form; end-user adds/drops columns pkaptein1 Access 6 February 15th, 2006 03:32 AM
It adds a new support to the eComm site subhasis.chakraborty ASP.NET 1.x and 2.0 Application Design 1 July 14th, 2005 03:46 PM
Javascript menu - Invasive adds jftonk Javascript 1 October 18th, 2003 05:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.