Saving and Retrieving Images to/from Sqlserver 2005

How to Save and retrieve Images from/to SqlServer2005

Page 1 of 1

5 Replies - 4785 Views - Last Post: 04 August 2009 - 04:20 AM Rate Topic: -----

#1 sakhr_99  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 01-March 09

Saving and Retrieving Images to/from Sqlserver 2005

Post icon  Posted 01 August 2009 - 03:21 AM

Dear All .

I've developed an application to do many things with multiple thread .

now the remaining things are done-able but im stuck in new requirement posted by Client which he needs to upload all images from Sql Server to Oracle Database now since old application stores images Path it is kind of new story now ?(:


i tried to build sample application since am not familiar with kind of above requested modification here is my code so far to upload images but i do not know what is wrong ?





'' Sql connection is over 

Dim fs as new fileStream (imgPath , io.fileMod.Open , Io.FileAccess.Read)

Dim imgByte (fs.length -1 ) as byte 
fs.Read (imgByte , 0 , ImgByte.length)

if imgByte.Length > 0  then
Con.open

cmd.Connection = Con
cmd.CommandType= CommandType.Text
Dim Cmd as new Sqlcommand ( " Insert into Demo values (" & imgByte & ") ") 


else 
msgbox ("Image not uploadable !")
end if 



Please any help or hint !!


also note that i need to save images locally from SQL server and then upload it to Oracle DB

Please help me with link or code !

(: thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Saving and Retrieving Images to/from Sqlserver 2005

#2 sakhr_99  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 01-March 09

Re: Saving and Retrieving Images to/from Sqlserver 2005

Posted 01 August 2009 - 11:02 PM

No replay ??

how frustrated !!
Was This Post Helpful? 0
  • +
  • -

#3 CamoDeveloper  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 20
  • View blog
  • Posts: 250
  • Joined: 12-June 09

Re: Saving and Retrieving Images to/from Sqlserver 2005

Posted 01 August 2009 - 11:10 PM

Looks like you're not specifying a column to insert to.

INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)



~Camo
Was This Post Helpful? 0
  • +
  • -

#4 sakhr_99  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 01-March 09

Re: Saving and Retrieving Images to/from Sqlserver 2005

Posted 02 August 2009 - 01:40 AM

Dear CamoDeveloper

thanks for replay but !!
i think no need to specify columns since you are providing all values for columns accordingly if you want to insert one column value then you need to go for your statement i.e.
insert into <table-Name> ( col1 ) values (valu1)

but if you want to insert all values then no need to provide columns names !

insert into demo values (val 1 , val2 , ... )


my problem is still hang ! and needs to be solved please !
Was This Post Helpful? 0
  • +
  • -

#5 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 43
  • View blog
  • Posts: 372
  • Joined: 17-July 09

Re: Saving and Retrieving Images to/from Sqlserver 2005

Posted 02 August 2009 - 01:59 AM

Have you actually tried what CamoDeveloper suggested? Thinking you dont need to and actually trying it is two different things. Try it and see if you still have the problem.

I also suggest reading Save and retreive images with SQL Server

This post has been edited by PDUNZ: 02 August 2009 - 02:04 AM

Was This Post Helpful? 0
  • +
  • -

#6 sakhr_99  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 01-March 09

Re: Saving and Retrieving Images to/from Sqlserver 2005

Posted 04 August 2009 - 04:20 AM

Dear PDUNZ
i already knew that if you have one column in your table and you did not specify your column name it works fine

for ex :

you have table has 3 columns name col1 , col2 and col3
your insert statement could be

insert into <tablename>
(col1,col2,col3)
values (1,2,3)


also you can write


insert into <tablename> values (1,2,3)

if values are same in terms of count and DataType of columns


this is common !
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1