Re: Copying Binary data from one table to another
- From: normanp <normanp@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 6 Mar 2008 04:53:01 -0800
This is the part that throws up the error.
CecExe.Execute("insert into binary_b (copy_a,copy_b,copy_c) values
('"&original("org_a")&"', '"&original("org_b")&"', "&original("org_c")&") ")
Actually i'm using these 3 cols only for testing. its a lot more complex in
the real thing.
"Bob Barrows [MVP]" wrote:
Actually, you've still lost me..
This is one of the few situations where I can recommend dynamic sql (but
only if you use parameters for user inputs - in other words don't ask the
user for a list of column names via a textbox - have him select them from a
listbox which uses column index as the value submitted, and use the
sebmitted index values to get the column names from an array in your
server-side code).
So you need col1 and col 3:
sql = "insert into table (col1,col3) select col1,col3 from othertable"
cn.execute sql,,129
If you need col 2, col3,col4 ... well, hopefully, you get the idea.
Or, if you need to update existing rows, use similar logic to build your
update statements. I'm not sure of the syntax used in MySQL to update a
table with values retrieved from another table, but you should be able to
find it in the documentation.
If you insist on using an inefficient cursor, you may need to look into
using AppendChunk. Look it up in the ADO documentation:
http://msdn2.microsoft.com/en-us/library/ms675532.aspx
And, as Evertjian says: the error is a vbscript error, not an ADO error. You
need to narrow down which statement in your code is actually throwing that
error.
normanp wrote:
Hi Bob,
Thanks. Unfortunately there is no other way for me to do this. I
have to select then insert. Because sometimes i may need a few
columns and sometime others. Its hard for me to put it in words. But
I think you'll understand.
By why will binary stuff not work?
Norman
"Bob Barrows [MVP]" wrote:
normanp wrote:
Hi,
I have these tables with binary data stored in tinyblobs and blobs
in MySql. In my application I sometimes need to copy them to another
table. Not all the data, maybe just a column or two. So I first
select the data into a record set and then loop and insert it (its
the only way can do it)
I've never worked with mysql, but this statement would make me
absolutely reject it as a database-of-choice if I was ever
considering it. Are you sure this is the only way? Can't you do a
simple "INSERT INTO tablename (<column list>) SELECT <column list>
FROM othertable" in MySQL?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
- Follow-Ups:
- Re: Copying Binary data from one table to another
- From: Bob Barrows [MVP]
- Re: Copying Binary data from one table to another
- References:
- Re: Copying Binary data from one table to another
- From: Bob Barrows [MVP]
- Re: Copying Binary data from one table to another
- From: Bob Barrows [MVP]
- Re: Copying Binary data from one table to another
- Prev by Date: Re: Copying Binary data from one table to another
- Next by Date: Re: Copying Binary data from one table to another
- Previous by thread: Re: Copying Binary data from one table to another
- Next by thread: Re: Copying Binary data from one table to another
- Index(es):
Relevant Pages
|
Loading