Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old February 18th, 2004, 03:25 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Modifying long text in a long field

Hi All

I am developing a website using asp and access. I have some pages in which user can type very long text in a textarea and submit it. The long text is saved in a memo field. When text is small (e.g. 1000 characters), it is saved (as well modified) successfully. But when I try to submit very long data (e.g. 4000 characters), it generates following error:

[Microsoft][ODBC Microsoft Access Driver] Could not save; currently locked by user 'admin' on machine 'ABC'.

and the error number is 2147467259.

My code is:

ProductID = request("Product ID")

Desc=request("Name")
ShortDesc=request("Short_Detail")
DetailDesc=request("DetailDescription")

mySQl= "select * from Product where idProduct='"&ProductID&"'"
call getfromdatabase(mySQL, rsModifyProduct ,"EditProduct")

rsModifyProduct("Description")=Desc
rsModifyProduct("Category")=Category
rsModifyProduct("ShortDetails")=ShortDesc
rsModifyProduct("DetailedDescription"=DetailDesc 'Memo Field

rsModifyProduct.update


*******************************
Database Manupulation Functions
*******************************

sub openDb()
if varType(connTemp)=0 or varType(connTemp)=1 then

  ' create the connection
  set connTemp = server.createObject("adodb.connection")

  connTemp.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Projects\MyProject\Database\MyProject.md b;"

end if
end sub


sub getFromDatabase(mySQL, rstemp, scriptName)

  call openDb()

  set rstemp = server.createObject("adodb.recordset")

  rstemp.open mySQL,connTemp,3,2

end sub

sub updateDatabase(mySQL, rstemp, scriptName)

call openDb()

set rstemp=connTemp.execute(mySQL)

end sub
  #2 (permalink)  
Old February 20th, 2004, 12:36 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Minneapolis, MN, USA.
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try this...

ProductId = request("ProductId")
Desc=request("Name")
Category = request("Category")
ShortDesc=request("Short_Detail")
DetailDesc=request("DetailDescription")

cn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\Projects\MyProject\Database\MyProject.md b;"

set rs = server.createobject("adodb.recordset")
sql = "select * from Product where idProduct = '" & ProductId & "'"
rs.open sql, cn, 3, 3
if rs.eof then
    rs.addnew
    rs("idProduct")
end if
    rs("Description") = Desc
    rs("Category") = Category
    rs("ShortDetails") = ShortDesc
    rs("DetailedDescription") = DetailDesc
    rs.update

This code will add the ProductId if it doesn't exist and modify it if it does. This is also provided that your ProductId is an alpha-numeric value rather than a number. If your ProductId is a number then you must not have it enclosed within apostrophes. Forget the function 'getfromdatabase()'. Make sure your memo field is last in the update. Not sure if it matters with an update, but it does matter when you include memo fields within your criteria so it might apply here too. Let me know if this helps.

Dave



Similar Threads
Thread Thread Starter Forum Replies Last Post
long text field SKhna SQL Language 1 June 6th, 2008 12:43 PM
Long Long int to bin walid C# 0 January 23rd, 2007 12:47 PM
Reading field of 'Long' datatype from binary file peri C# 0 January 2nd, 2005 08:50 AM
string to "long long" without using atoll sarraju C++ Programming 2 August 4th, 2004 07:19 AM
Long text irfan4 ASP.NET 1.0 and 1.1 Basics 1 July 27th, 2004 09:30 AM





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