Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 18th, 2004, 02: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
Reply With Quote
  #2 (permalink)  
Old February 20th, 2004, 11:36 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Minneapolis, MN, USA.
Posts: 171
Thanks: 0
Thanked 0 Times in 0 Posts
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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 11:47 AM
Reading field of 'Long' datatype from binary file peri C# 0 January 2nd, 2005 07: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



All times are GMT -4. The time now is 10:21 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.