hi
i am a beginner of asp and want to add an image to the page ?
would u guide me?
See the thread here:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1769613&SiteID=1
Jens K. Suessmeyer.
http://www.sqlserver2005.de
hi
i am a beginner of asp and want to add an image to the page ?
would u guide me?
See the thread here:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1769613&SiteID=1
Jens K. Suessmeyer.
http://www.sqlserver2005.de
Working on what will hopefully be quite a big site and the user will be asked for some details, one of which will be an image (jpg, gif or bmp).
Rather than add the image to a folder on the server,?a?folder which could end up being quite large, I was hoping someone could give me some help, suggestions?or even point me towards a tutorial on how to store the image in an SQL database.
Any helps appreciated, thanks :)never mind, read some articles about why this isn't a good idea :)
just going to store the images in a folder|||Here is an article from msdn if someone still interests:Read and Write BLOB Data by Using ADO.NET Through ASP.NET
I have created a basic database that is only one table. One of the fields is LogPicture with type of image.
I just want to go into the table and manually place a picture in the table, but it seems like I can not get the format down. I have tried including the picture I want into the project, but no dice. I've also tried putting the physical pathname (on the harddrive) and the web address of this field in there. Suggestions please?
*bump*
I am basically just looking for the syntax of how an image is inserted. Anyone..... please?|||
Image data is stored as binary stream in SQL Server. You can either use bcp.exe utility to insert BLOB data (image/text/ntext) or write your own code to input binary stream to the column. You can take a look at this post:
http://forums.asp.net/thread/1257487.aspx
And here is a article that introduces bcp utility:
http://msdn2.microsoft.com/en-us/library/ms162802.aspx
Hi,
I am using SQL Server 2005. I have a table in my database which has two columns :
ImageId (Type: nvarchar (50))
Image (Type: image)
I need to store images in this table. How can I do this?
Depends on what do you use for writing client applications.|||Example using VB 6.0, SQL Server 2005 and SQLNCLI as the provider.
Private Sub Main()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim mystream As New ADODB.Stream
cn.CursorLocation = adUseClient
cn.Open "Provider=SQLNCLI;Data Source=.;Integrated Security=SSPI;"
mystream.Type = adTypeBinary
rs.Open "select * from imagetable where imagetable.ImageId=''", cn, adOpenStatic, adLockOptimistic
rs.AddNew
mystream.Open
mystream.LoadFromFile "c:\\test.jpg"
rs!ImageId = "image1"
rs!MyImage = mystream.Read
rs.Update
mystream.Close
rs.Close
cn.Close
End Sub
Hi,
I am using SQL Server 2005. I have a table in my database which has two columns :
ImageId (Type: nvarchar (50))
Image (Type: image)
I need to store images in this table. How can I do this?
Depends on what do you use for writing client applications.|||Example using VB 6.0, SQL Server 2005 and SQLNCLI as the provider.
Private Sub Main()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim mystream As New ADODB.Stream
cn.CursorLocation = adUseClient
cn.Open "Provider=SQLNCLI;Data Source=.;Integrated Security=SSPI;"
mystream.Type = adTypeBinary
rs.Open "select * from imagetable where imagetable.ImageId=''", cn, adOpenStatic, adLockOptimistic
rs.AddNew
mystream.Open
mystream.LoadFromFile "c:\\test.jpg"
rs!ImageId = "image1"
rs!MyImage = mystream.Read
rs.Update
mystream.Close
rs.Close
cn.Close
End Sub
Hello:
I have an Image control on my report .
I have a Class for example :
public Class Class1
private _MyPic as System.Drawing.Image
public property MyPic as System.Drawing.Image
......
end
end
the Dataset Of My Report is Class1.
i Drop an Image from toolbar in My Report and set Source to Database and set value to =Fields!MyPic.value
befor showing the Report i Create an object from Class1 and fill MyPic and set DataSet of Report to that Object
but i see a Red X instead of Picture
please help me
thanks alot
Setting the image source = Database is correct, but you have to convert the System.Drawing.Image into the actual image data as byte array.
Here is a C# code snippet to convert an image into a byte[] using a MemoryStream:
// save image to byte[]
System.IO.MemoryStream renderedImage = new MemoryStream();
myImage.Save(renderedImage);
renderedImage.Position = 0;
return renderedImage.ToArray();
-- Robert
Hello, SuperNove289 (wow! :)
Simple question- simple answer:
Assume, you have this Table_1 with SelectedImages and Path fields.
CREATE TABLE [dbo].[Table_1](
[SelectedImages] [image] NOT NULL,
[Path] [ntext] NOT NULL
)
to add an image, do this:
INSERT INTO [testing].[dbo].[Table_1]
([SelectedImages]
,[Path])
VALUES
('D:\desktop\05022006\free_chart1.gif' ,'D:\desktop\05022006\free_chart1.gif' )
So, then you will do this :
SELECT [SelectedImages]
,[Path]
FROM [testing].[dbo].[Table_1]
You will get something like this:( <Binary data>)
SelectedImages Path
- -
0x443A5C6465736B746F705C30353032323030365C667265655F6368617274312E676966 D:\desktop\05022006\free_chart1.gif
(1 row(s) affected)
Probably the next question will be is how to see the entered image J
|||Hi SuperNova,
As suggested you may definately add images to your database but this is not the best practise you should avoid such BLOB operation refer http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2006-45 research done at MS, instead store file path of documents and handle it from Front End Applciation.
HTH
Hemantgiri S. Goswami
|||That depends on your coding language how to upload the data to the server, for C#, see this sample which is quite simple.http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=622943&SiteID=1
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
Sql Activity log backup,sql backup,sql log backup