473,513 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting unicode characters into a database using RecordSet.Update

I'm using ASP, VBScript and SQL Server.

I'm also using UTF-8 character set and so my codepage is 65001 and SQL
Server datatype nvarchar.

I can insert unicode characters correctly into the database table using
INSERT.... (field1) ...VALUES ......... (N'Characters').

How do I do this using Rs.Update viz-a-viz:

Rs.Open .......
Rs.New
Rs("Field1") = "Characters"
Rs.Update

Thanking you in anticipation.
Apr 6 '06 #1
10 12246
Roger Withnell wrote:
I'm using ASP, VBScript and SQL Server.

I'm also using UTF-8 character set and so my codepage is 65001 and SQL
Server datatype nvarchar.

I can insert unicode characters correctly into the database table
using INSERT.... (field1) ...VALUES ......... (N'Characters').
Since you can do it this way ...
How do I do this using Rs.Update viz-a-viz:

why would you ever want to use a recordset for updating data in an asp
application?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Apr 6 '06 #2

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uq*************@TK2MSFTNGP05.phx.gbl...
Roger Withnell wrote:
I'm using ASP, VBScript and SQL Server.

I'm also using UTF-8 character set and so my codepage is 65001 and SQL
Server datatype nvarchar.

I can insert unicode characters correctly into the database table
using INSERT.... (field1) ...VALUES ......... (N'Characters').

Since you can do it this way ...
How do I do this using Rs.Update viz-a-viz:

why would you ever want to use a recordset for updating data in an asp
application?


Because I'm inserting images at the same time, creating a thumbnail and a
main image, using AspUpload and AspJpeg.
Apr 6 '06 #3
Roger Withnell wrote:
why would you ever want to use a recordset for updating data
in an asp application?


Because I'm inserting images at the same time, creating a
thumbnail and a main image, using AspUpload and AspJpeg.


You can still accomplish that without using recordsets. Assign the
properties of the File.Binary property to a parameter of an ADODB.Command
Object, for example.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Apr 6 '06 #4

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:eE**************@TK2MSFTNGP02.phx.gbl...
Roger Withnell wrote:
why would you ever want to use a recordset for updating data
in an asp application?


Because I'm inserting images at the same time, creating a
thumbnail and a main image, using AspUpload and AspJpeg.


You can still accomplish that without using recordsets. Assign the
properties of the File.Binary property to a parameter of an ADODB.Command
Object, for example.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.
Use of this email address implies consent to these terms.


I'd rather not change the code I have already. Is it not possible to insert
the correct Unicode characters into the table using Rs.Update?
Apr 6 '06 #5

"Roger Withnell" <ro*********@THISupperbridge.co.uk> wrote in message
news:11*************@sp6iad.superfeed.net...
I'm using ASP, VBScript and SQL Server.

I'm also using UTF-8 character set and so my codepage is 65001 and SQL
Server datatype nvarchar.

I can insert unicode characters correctly into the database table using
INSERT.... (field1) ...VALUES ......... (N'Characters').

How do I do this using Rs.Update viz-a-viz:

Rs.Open .......
Rs.New
Rs("Field1") = "Characters"
Rs.Update

Thanking you in anticipation.


Have you tried it? Did it work?
What do imagine you might need to change in the above to make it work?


Apr 7 '06 #6
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
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Apr 7 '06 #7

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uL**************@TK2MSFTNGP02.phx.gbl...
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


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. I don't see how to do this using INSERT. If there
is a way, great. 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?


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Apr 7 '06 #8
Roger Withnell wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uL**************@TK2MSFTNGP02.phx.gbl...
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


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.


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
I don't
see how to do this using INSERT. If there is a way, great.
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.
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?


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
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Apr 7 '06 #9

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:eV**************@TK2MSFTNGP04.phx.gbl...

"Roger Withnell" <ro*********@THISupperbridge.co.uk> wrote in message
news:11*************@sp6iad.superfeed.net...
I'm using ASP, VBScript and SQL Server.

I'm also using UTF-8 character set and so my codepage is 65001 and SQL
Server datatype nvarchar.

I can insert unicode characters correctly into the database table using
INSERT.... (field1) ...VALUES ......... (N'Characters').

How do I do this using Rs.Update viz-a-viz:

Rs.Open .......
Rs.New
Rs("Field1") = "Characters"
Rs.Update

Thanking you in anticipation.


Have you tried it? Did it work?
What do imagine you might need to change in the above to make it work?


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
Apr 7 '06 #10

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:Ob**************@TK2MSFTNGP03.phx.gbl...
Roger Withnell wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uL**************@TK2MSFTNGP02.phx.gbl...
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


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.


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
I don't
see how to do this using INSERT. If there is a way, great.


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.
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?


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


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
Apr 7 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
18312
by: Spamtrap | last post by:
I only work in Perl occasionaly, and have been searching for a solution for a conversion, and everything I found seems much too complex. All I need to do is take a simple text file and copy...
0
1495
by: Dagoberto | last post by:
Hello, my server is red hat linux 9 postgresql 7.3.2, my client is windows xp professional odbc postgresql+ unicode beta (postgresql unicode beta some times) my database has unicode encoding. ...
0
2419
by: Marko Poutiainen | last post by:
Situation: We had to make our SQLServer 2000 database multi-lingual. That is, certain things (such as product names) in the database should be shown in the language the user is using (Finnish,...
3
5607
by: Mohammad-Reza | last post by:
We are writing an application for a specific culture(Arabic or Farsi). This application involves using DataAdapter, OLEDB Connection and the DataSet. We didn't use the .NET data binding, just field...
3
17943
by: john | last post by:
I need to produce a RTF-document which is filled with data from a database. I've created a RTF-document in WordPad (a template, so to speak) which contains 'placeholders', for example '<dd01>',...
2
7250
by: pramod | last post by:
Hi I am facing the problem while inserting the spanish characters in the DB2 UDB v8.2 database. We are pulling the data from SQL server through informatica and then pushing the same in the DB2...
1
3062
by: shorti | last post by:
Hello, I am running DB2 UDB 8.2 on AIX 5.3. I am running some tests on converting several tables on an existing database to Unicode. The database will not be converted to unicode...just this...
3
2358
by: lovzan | last post by:
hello; i work on vb.net with mysql database i use ADO. the problem is that i can't insert into the table arabic or other unicode string. Dim rs As New ADODB.Recordset rs.Open("select *...
2
3095
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.