|
-
May 29th, 2008, 03:37 AM
#1
Thread Starter
Fanatic Member
Insert failed
Hi
I have SQL Server 2000 table "FilePerson" that contains a field of type varbinary.I want to insert into that field a value like "C:\xx.xls" but the insert failed.
the following message appeared:
Insert into FilePerson(_ID,_Path) VALUES('4','c:\xxx.xls')
Disallowed implicit conversion from data type varchar to data type varbinary, table 'FilePerson', column '_Path'. Use the CONVERT function to run this query.
Any help
thanks
-
May 29th, 2008, 03:51 AM
#2
-
May 29th, 2008, 06:04 AM
#3
Re: Insert failed
Moved to Database Development
-
May 31st, 2008, 04:40 AM
#4
Re: Insert failed
If it's asking for VARBINARY then it may be that your data type for _Path is not varchar but is varbinary. We shouldn't have to be guessing this though, you should be telling us what the datatypes for your table columns are.
If it is indeed VARBINARY then it is expecting the actual binary data of the file, not the path to the file. You will need to read that file c:\xxx.xls into a stream into a byte array and then pass that in your statement.
-
Jun 2nd, 2008, 01:46 AM
#5
Thread Starter
Fanatic Member
Re: Insert failed
mendhak
_Path is varbinary.
You will need to read that file c:\xxx.xls into a stream into a byte array
how can I read te file into a byte array
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|