"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:ObSHFmlWGHA.5096@TK2MSFTNGP03.phx.gbl...[color=blue]
> Roger Withnell wrote:[color=green]
>> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
>> news:uLX6ZdkWGHA.4212@TK2MSFTNGP02.phx.gbl...[color=darkred]
>>> Roger Withnell wrote:
>>>> I'd rather not change the code I have already.
>>>
>>> Even if the change results in a more efficient, better-performing
>>> application?
>>>
>>> At the very least, since you are processing multiple records, you
>>> should open your recordset using adLockOptimisticBatch for the lock
>>> type, disconnect it (by setting the ActiveConnection property to
>>> nothing and closing your connection), add your records using Update,
>>> reconnect it (by opening the connection and setting the
>>> ActiveConnection property to the opened connection object) and use
>>> updateBatch to send the new records to the
>>> database.
>>>
>>>> Is it not possible to
>>>> insert the correct Unicode characters into the table using
>>>> Rs.Update?
>>>
>>> Of course it is. All I can do is repeat Anthony's question: have you
>>> tried it?
>>>
>>> Bob Barrows
>>> --
>>> Microsoft MVP -- ASP/ASP.NET[/color]
>>
>> I am inserting one record, not multiple records. A record has a
>> subject and a caption (both nvarchar), a thumbnail and a main image
>> both created from the same original image file, using AspUpload and
>> AspJpeg to upload and re-size the images. As well as the subject and
>> caption, I upload the original image, re-size it with AspJpeg to the
>> main image size, put this in the recordset and then re-size the image
>> again to the thumbnail size and put that in the recordset.[/color]
>
> All of this activity should take place before opening the recordset. The
> goal is to stay connected to the database for as short a time as possible.
> So do your resizing, etc. then open the connection and recordset and
> assign
> the values to the fields. If that is not possible due to limitations of
> the
> upload tool you are using, then use a disconnected recordset
>[color=green]
>> I don't
>> see how to do this using INSERT. If there is a way, great.[/color]
>
> Yes, you would use a Command object to pass the data to a string
> containing
> parameter markers
>
> strsql = "INSERT (Subject,Caption,Thumb) VALUES (?,?,?)"
> Const adVarWChar = 202
> Const adLongVarBinary = 205
> Const adParamInput = &H0001
> Subj="xxxxxx"
> Capt = "xxxxx xxx xxxxx"
> SubjSize = 50 ' just a guess on my part
> CaptSize = 200 ' again, just a guess - adjust if incorrect
> set cmd=createobject("adodb.command")
> with cmd
> .commandtext=strsql
> .commandtype=1 'adCmdText
> set .ActiveConnection = conn
> .Parameters.Append .CreateParameter("first",adVarWChar, _
> Subjsize,adParamInput, Subj)
> .Parameters.Append .CreateParameter("second",adVarWChar, _
> Captsize,adParamInput, Capt)
> .Parameters.Append .CreateParameter("third", _
> adLongVarBinary, ,adParamInput, thumbnail)
> .execute ,,128 'adExecuteNoRecords
> end with
>
> or better yet, a stored procedure, which would enable you to use my tool
> available at
>
http://www.thrasherwebdesign.com/ind...s&hp=links.asp to
> generate
> the command object parameter creation code.
>[color=green]
>> If there
>> isn't, how do I get the correct Unicode characters in the subject and
>> caption fields into the table via a recordset with Open, AddNew and
>> Update?[/color]
>
> I'm sorry, but all I can say is: just do it. The code in your first post
> should work. What is the issue?
>
> --
> Microsoft MVP -- ASP/ASP.NET
>[/color]
Whoops! Didn't set Upload.CodePage = 65001 in AspUpload.
Sorry to waste your time.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com