Any suggestions for getting by this error?
(cannot convert 1 dimensional array of byte to string)
Dim bufferLength As Integer = Convert.ToInt32(image_file.PostedFile.InputStream. Length)
Dim imageBytes As Byte()
ReDim imageBytes(bufferLength)
DB.InsertCommandType = SqlDataSourceCommandType.Text
DB.InsertCommand = "INSERT INTO TBL_IMAGE (IMAGE_ID, IMAGE_NAME_LG, IMAGE_DATA_LG, IMAGE_CONT_LG) VALUES (@p_image_id, @p_image_name_lg, @p_image_data_lg, @p_cont_lg)"
DB.InsertParameters.Add("p_image_id", image_id)
DB.InsertParameters.Add("p_image_name_lg", image_title.Trim())
'Load(image_file) InputStream into Byte array
image_file.PostedFile.InputStream.Read(imageBytes, 0, bufferLength)
image_file.PostedFile.InputStream.Close()
DB.InsertParameters.Add("p_image_data_lg", imageBytes)
DB.InsertParameters.Add("p_cont_lg", mime_type)
'Connect to the database and insert the record
DBConnect(DB)
success = DB.Insert()
1 1122
Any suggestions for getting by this error?
(cannot convert 1 dimensional array of byte to string)
Dim bufferLength As Integer = Convert.ToInt32(image_file.PostedFile.InputStream. Length)
Dim imageBytes As Byte()
ReDim imageBytes(bufferLength)
DB.InsertCommandType = SqlDataSourceCommandType.Text
DB.InsertCommand = "INSERT INTO TBL_IMAGE (IMAGE_ID, IMAGE_NAME_LG, IMAGE_DATA_LG, IMAGE_CONT_LG) VALUES (@p_image_id, @p_image_name_lg, @p_image_data_lg, @p_cont_lg)"
DB.InsertParameters.Add("p_image_id", image_id)
DB.InsertParameters.Add("p_image_name_lg", image_title.Trim())
'Load(image_file) InputStream into Byte array
image_file.PostedFile.InputStream.Read(imageBytes, 0, bufferLength)
image_file.PostedFile.InputStream.Close()
DB.InsertParameters.Add("p_image_data_lg", imageBytes)
DB.InsertParameters.Add("p_cont_lg", mime_type)
'Connect to the database and insert the record
DBConnect(DB)
success = DB.Insert()
first check the code
image_file.PostedFile.InputStream.Read( imageBytes, 0, bufferLength)
DB.InsertParameters.Add("p_image_data_lg", imageBytes)
see imagebyte is of type byte so check the functions which accepting the parameter imagebyte, the function may accept string.. first check all the function & its parameter types which u r used is correct or not..
then also error come means reply me i will try..
Sign in to post your reply or Sign up for a free account.
Similar topics
by: TheTenor |
last post by:
I have a page with a graphic. I want to be able to define the graphics such
that it is not saved when the viewer saves the page to his local drive. I'm
trying to avoid having a seperate folder...
|
by: M Keeton |
last post by:
I currently have a picture which is stored in a "System.Drawing.Image"
variable and I want to save it as a bitmap file.
I have tried 2 different approaches and both give me the following error:
...
|
by: Jeff |
last post by:
Hey
(and thank you for reading my post)
In visual web developer 2005 express edition I've created a simple website
project..
At this website I want users who register to be able to upload a...
|
by: sameer |
last post by:
Hi all,
..net framwork 1.1
sql server 2000
I have a vb.net winforms application using webservices\ remoting to
upload documents\ images to the webserver and i am gong to store them in the
sql...
|
by: sameer |
last post by:
Hi all,
..net framwork 1.1
sql server 2000
I have a vb.net winforms application using webservices\ remoting to
upload documents\ images to the webserver and i am gong to store them in the
sql...
|
by: Mark Denardo |
last post by:
My question is similar to one someone posted a few months back, but I don't
see any replies.
Basically I want to be able to have users upload photos and save them in a
database (as byte data)...
|
by: pozze |
last post by:
Hi,
I've just made the change from ASP to .net.
I have a file (code below) that saves a user submitted file to a MS SQL 2005 database. It collects the file name, file size, file type, and lastly...
|
by: Marco Pais |
last post by:
Hi there.
I'm developing a small application that uses Web Services to access database
and store data.
At some point, I store some images, by inserting the absolute image path
into a varchar...
|
by: Eddie |
last post by:
Hi all,
I am displaying a number of reports, and giving the users an option to
display them on the web or download them to Excel. If they want the
Excel file, I just use the PHP header command...
|
by: Nathan Sokalski |
last post by:
I am using ASP.NET 2.0, and need to know how to save and use an image that
is stored in an SQL Server image datatype. How can I do this using ASP.NET?
Thanks.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |