Retrieve Database Image By 2 Ids

Feb 28, 2008

Hi, I'm stuck trying to figure out how to call an image from the database by certain ids.  I want to get it like this: page.aspx?pictureid=#&userid=#

here's the show.aspx:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim PictureID As Integer = Convert.ToInt32(Request.QueryString("ppID"))Dim MemberID As Integer = Convert.ToInt32(Request.QueryString("mID"))

'Connect to the database and bring back the image contents & MIME type for the specified pictureUsing myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("objConn").ConnectionString)

Const SQL As String = "SELECT [ppMIMEType], [ppImageData] FROM [tblPP] WHERE ([ppID] = @ppID) & ("[mID] = @mID)"Dim myCommand As New SqlCommand(SQL, myConnection)

myCommand.Parameters.AddWithValue("@ppID", PictureID)

myCommand.Parameters.AddWithValue("@mID", MemberID)

myConnection.Open()Dim myReader As SqlDataReader = myCommand.ExecuteReader

If myReader.Read ThenResponse.ContentType = myReader("ppMIMEType").ToString()

Response.BinaryWrite(myReader("ppImageData"))

End If

myReader.Close()

myConnection.Close()

End Using

End Sub

 here's the formview to display image with datasource:

<asp:FormView ID="PictureUI" runat="server" DataKeyNames="ppID,mID" DataSourceID="PicturesDataSource" AllowPaging="False" EmptyDataText="There are currently no pictures uploaded" HorizontalAlign="Center" CellPadding="0">

<ItemTemplate>

<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("ppID", "~/Show.aspx?ppID=" & 1 &"mID=" & 1 &"") %>' />

 

</ItemTemplate>

 

</asp:FormView>

 

<asp:SqlDataSource ID="PicturesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:Connect %>"

SelectCommand="SELECT [ppID], [ppDateTime], [mID] FROM [tblPP] ORDER BY [ppDateTime]">

</asp:SqlDataSource>

View 3 Replies


ADVERTISEMENT

How To Load Image To And Retrieve From Database(sql Server)

Feb 19, 2005

can anyone out there help me to solve this problem???

how to load image to and retrieve from database(sql server)??
thanks alot

cyndie

View 3 Replies View Related

HOW To Retrieve An Image From Sql Server And Display It In ASP.net Using Imagemap Or Image ?

Jul 6, 2006

Ok, the problem is that , i have a field called "Attach" in sql of type image, when selecting it , the field is getting data of type BYTE(). which am being unable to display them on an Image on the panel.

using the following vb.net code:

'Dim sel2 As String

'Dim myCom As SqlCommand

'Dim conn As New SqlConnection

'Dim drr As SqlDataReader

'Dim image As System.Drawing.Image

'sel2 = "select * from attach where att_desc = '" & DropDownList1.SelectedItem().Text & "' and doc_code = " & w_doc_code & " and subcode = " & w_doc_subcode & " and doc_num= " & w_doc_num & " "

'conn.ConnectionString = ("server=developer01;uid=sa;password=aims;database=DVPSOC;timeout=45")

'myCom = New SqlCommand(sel2, conn)

'conn.Open()

'drr = myCom.ExecuteReader()

'If drr.Read Then

' Me.ImageMap1.ImageUrl = drr.Item("attach")

'End If

'conn.Close()

Am getting an exeption on the following line Me.ImageMap1.ImageUrl = drr.Item("attach")

saying: Conversion from type 'Byte()' to type 'String' is not valid.

knowing that i tried converting using ToString but it's not getting any output then.

thanks for your help.

View 4 Replies View Related

Retrieve And Display Image Inside An Html File (stored In Database) In Binary Format

May 15, 2007

Hi All,
I am not sure whether this is the right place to post this question. But I am unable to figure out what is the best solution to retrieve and display an image in a html file(stored in varbinary(max) column). I have a list of images in the file and I am supposed to display them. Can anybody please let me know what is the best way to do this?
Thanks a lot!!

View 1 Replies View Related

Retrieve Image From SqlServer

Nov 7, 2006

hi all
i hav a database with some images...images r stored in binary data form
i want to retrieve that image from database and display it in a details View
im inserting images to database like this
public void OnUpload(Object sender, EventArgs e)
{
int len = Upload.PostedFile.ContentLength;
byte[] pic = new byte[len];
Upload.PostedFile.InputStream.Read (pic, 0, len);
SqlConnection connection = new SqlConnection ("integrated Security=SSPI;Persist Security Info=False;Initial Catalog=dbAsoftWeb;Data Source=ASP");
try
{
connection.Open ();
SqlCommand cmd = new SqlCommand("insert into tblStock " + "(Image, Image_Data,[DESC],PRICE,BAL_QTY,PV) values (@pic, @text, @lblProd, @lblPrice, @lblPV, @lblQty) ", connection);
cmd.Parameters.Add("@pic", pic);
cmd.Parameters.Add("@text", Comment.Text);
cmd.Parameters.Add("@lblProd", txtProdName.Text);
cmd.Parameters.Add("@lblPrice", txtPrice.Text);
cmd.Parameters.Add("@lblPV", txtPV.Text);
cmd.Parameters.Add("@lblQty", txtQty.Text);
cmd.ExecuteNonQuery ();
}
finally
{
connection.Close ();
}
im able to get the image in to form but i want to display it in a detailsview
how cani do it..can any one explain me
thanks in advance
Hari

View 1 Replies View Related

Retrieve An Image, For Display On Website?

Feb 25, 2006

How would I do if I want to make a query that returns an image, which in turn should be displayed on a webpage?

View 2 Replies View Related

To Retrieve Image Data From A Table

Jul 25, 2001

Hi,
Can any one help me to retrieve an image data from a table.
I wanted to show the images on my web page using ASP.
I am trying with pub_info table of pubs database, in this table logo is a image data type colum. I opened a record set in ASP page and I am not able to retrieve the image from the record set.

Any help is appreciated!

Ravi.

View 2 Replies View Related

How Do I Retrieve SQLCE Bitmap Image

May 4, 2007

Hello,

I have not seen a response to this specific question so here goes. I had working code for loading an image into my smart device SQLCE db and for retrieving images. But after upgrading my application to SQLCE 2.0 I am unable to use my retrieve code. This is what was previously working,



Dim ImageBytes As Byte = rs.GetValue(rs.GetOrdinal("OLE"))

Dim ImageStream As New System.IO.MemoryStream(ImageBytes)

frmFlashcardActive.picboxBlobToPicBox.Image = New Bitmap(ImageStream)



Help!



This is what I successfully use to save the image to the database



Dim PictureInfo As New FileInfo("My DocumentsUSAFlag.bmp") 'OpenDialog.FileName

Dim PictureSize(PictureInfo.Length) As Byte

If PictureSize.GetValue(0) <= 69 Then

Dim fsPicture As New FileStream(PictureInfo.FullName, FileMode.Open)

Dim PictureReader As New BinaryReader(fsPicture)

PictureReader.Read(PictureSize, 0, PictureSize.Length)

'find the previous record and add the picture

rs.SetValue(rs.GetOrdinal("OLE"), PictureSize) 'could be FlashcardAPic

rs.SetValue(rs.GetOrdinal("Picture"), "True")

rs.Update()

fsPicture.Close()

View 1 Replies View Related

How To Retrieve Image Stored In SQL Server From My VB Project

Nov 29, 2001

Hi anyone can help me? i would like to retrieve an image stored in my SQL server from my VB project using ADO... anyone familiarise in it? pls help me... i need it urgently..... tks...

View 1 Replies View Related

Image Located On Web, Url For Image Stored In Database

Aug 17, 2007



Hi,
I have a website and i am uploading the gif image to the database. i have used varchar(500) as the datatype and i am saving the file in the webserver so the path to it c:intepub....a.gif


my upload table has the folliwing feilds
UploadId Int Identity, Description, FileName, DiskPath varchar(500), weblocation varchar(500). I have a main sproc for the report where i am doing a inner join with other table to get the path of the gif..

So my question is how can i get a picture to show up on the report. .
What kinda datatype the gif file should be stored in the database? If it is stored as a varchar how can i access it and what is best way to reference that particular.

any help will appreciated....
Regards
Karen

View 9 Replies View Related

How Can I Retrieve A Pdf File From The Database?

Nov 9, 2006

i'm working with a project right now that needs pdf file retrieval from the database with the use of a search engine... any codes that could make that search engine to function properly? and make it work?

View 1 Replies View Related

How To Retrieve Data As XML From SQL Database

Feb 28, 2007

Hi,
I have a website which is designed to search for employee information. I have the search system working which does exactly what I want to, but as an added feature I want there to be a button which, when someone clicks on it, it takes whatever the previous search was and generates a set of data in XML format which is based on the results. For example:
User searches for all entries with Forename = John; Results are listed in a gridview as per expected.
User then presses button with XML on it, and page pops up with just the XML output on it, i.e. whatever results are on the gridview but in a nested XML format
<records>    <record>       <Forename>John</Forename>       <Surname>Smith</Surname>       <Email>j.smith@blah.com</Email>       <Ext>1234</Ext>       <DeptList>History</DeptList>    </record></records>
I have created a stored procedure which will take the parameters from the search boxes and return the above information, but I don't know if this is the best way. Here it is for those interested:
CREATE PROCEDURE ps_record_SELECT_NameSurnameEmailExtDeptasXML
@Forename varchar(50),
@Surname varchar(50),
@Email varchar(50),
@Ext varchar(4),
@DeptList varchar(50)
AS
SELECT Forename, Surname, Email, Ext, DeptList
FROM dbo.record
WHERE Forename LIKE COALESCE(@Forename,Forename) AND
Surname LIKE COALESCE(@Surname,Surname) AND
Email LIKE COALESCE(@Email,Email) AND
Ext LIKE COALESCE(@Ext,Ext) AND
DeptList LIKE COALESCE(@DeptList,DeptList)
FOR XML AUTO, ELEMENTS
If someone could be kind enough to help me out with this, I'd be really grateful.
Many thanks,
Tom

View 2 Replies View Related

How To Retrieve Resume From Database

Mar 20, 2008

I stored resume in database with datatype Image. But now i want to retrieve the resume becoz if user wants to edit their resume and again i shud store the updated resume into my database.
Give me ideas...Thanks in adv!! 
 

View 4 Replies View Related

How Do I Retrieve The Available Tables In A Database

Sep 20, 2004

I need to retrieve the available tables in a database in SQL Server 2000. I found this command and although it works I can't figure out how to filter the results.

exec sp_tables

I don't want to return the whole list, just the tables starting with "OV" and "SV". Does SQL Server 2000 support a wildcard? Like can I have it search for "OV*" or do I have to use LIKE. Did google search with no helpful results. I remember in mySQL this was simply "SHOW Tables" but this command isn't supported in SQL Server 2000.

any help would be appreciated

thanks

View 1 Replies View Related

Retrieve Data From Different Database

Sep 24, 2007

Hi, Im new to SQL 2005.
I want to know that, any way i can use to get data from different database?

View 2 Replies View Related

How To Add Image Into Sql Database

Feb 14, 2005

hi, friends

i need your help.
i want to add image into sql database.
how can i do this?

plz give any solution.

thank in advance.

it's urgent.

View 1 Replies View Related

Getting Image Into Database

Jun 7, 2006

Hey all, I have a table that i would like to be able to store images in but dont know how i can ge them in there.  How can i put the image in the database?  (sql express 2005, VS 2005 Pro) vbThanks!

View 1 Replies View Related

Sql Image Database

Aug 2, 2007

hi,
please help me about
how can I make a database containing image
I mean I want to make a database recording the date field and the image specified
how would it be possible the database show the image in records

View 1 Replies View Related

Retrieve File Stored In SQL Database ...

Sep 19, 2006

Hi there I'm using VS2005 (VB.net) and SQL 2005. We've uploaded files from the web application to the SQL database. The next thing I want to be able to do is to retrieve this uploaded file(s) from the database and attach it in the email when the user click on the Submit button on the web form. How can this be done ? Any help would be greatly appreciated. TIA

View 1 Replies View Related

Retrieve Record From Database Problem

Sep 21, 2006

i m using sql server 2000 with asp.net with c#

i hv 4 customer records in the customer table starting from C1001 to C1004, i wanna ask is that when a new record is add to the table, the record will be placed at the bottom of the table. For example,
CustomerID






Customer ID

C1001

C1002

C1003

C1004

C1005


When i add a new record which is C1005, is it the record will be placed as shown in the table?


if so, that's mean can straight away use the datarow to retrieve the largest number which is C1005, right??? Thx 

View 1 Replies View Related

How To Store Linefeeds To A Database And Retrieve Them

Oct 11, 2007

 hello all,          I have a multi line textbox and want to store the content of the textbox to a database. I want to preserve the linefeeds so that I display the message as it is typed by retrieving it. Can anyone please explain how to store the linefeeds to the database. Once i store the linefeeds to the database, I can restore them using the Replace("","<br/>) method. But I can't figure out how to store the   's in the database in the first place. Thanx in advance 

View 2 Replies View Related

Retrieve 00012 Number From SQL Database

Nov 20, 2007

Hye all.. ;-)Question : 1. I try to Retrieve "00012" number from SQL Database..But the Return value is "12"..Wht I need is "00012" not "12". How I gonna do that?2. Because why..I need to save again that number in another Table. I'm using Data Type as "nvarchar(50)". Thank you. 

View 4 Replies View Related

Dropdownlist Retrieve Data From Sql Database

Feb 13, 2008

i have 2 dropdownlist which is  ddlCategory and ddlItem.i want<<< a)both ddl get data from sql db.b)view the data in gridview.   i need code in vb.net to retrieve and post.tq  

View 1 Replies View Related

How Can I Store And Retrieve Images From A Database

Mar 23, 2008

hi,
i would like to store images in my database and retirve them aswell. i have looked at examples on the net but i am finding it hard to follow and undertsand them, can anyone please give me adivse on how i can do this. i have alrady created my table in my database which has 4 fields pictureID, pictureContent, pictureType and pictureSize but i dont know where to go on from here. i want to do it in vb aswell.
please any help and advise would be much appreciated as i am stuck,
thank you

View 20 Replies View Related

How To Upload And Retrieve Images From The Database

Mar 26, 2008

i am using sql server,asp.net and C# language.I am able to upload data into the database but couldnt retrieve it from the database.i am using the following code to upload image into the database.kindly help.
 
 SqlConnection connection = null;         try         {             FileUpload img = (FileUpload)imgUpload;             Byte[] imgByte = null;             if (img.HasFile && img.PostedFile != null)             {                 HttpPostedFile File = imgUpload.PostedFile;                 imgByte = new Byte[File.ContentLength];                 File.InputStream.Read(imgByte, 0, File.ContentLength);             }             string conn = connection establishing string;             connection = new SqlConnection(conn);             connection.Open();             string sql = "insert into imagetable values(@enm, @eimg) SELECT @@IDENTITY";             SqlCommand cmd = new SqlCommand(sql, connection);             cmd.Parameters.AddWithValue("@enm", txtEName.Text.Trim());             cmd.Parameters.AddWithValue("@eimg", imgByte);             int id = Convert.ToInt32(cmd.ExecuteScalar());             lblResult.Text = String.Format("Employee ID is {0}", id);         }         catch         {             lblResult.Text = "There was an error";         }        finally        {            connection.Close();        }

View 9 Replies View Related

Retrieve Select Information From A Database

Mar 31, 2008

If I had a bunch of paragraphs stored in a database field, is there a way, when displaying that data, that I can write instructions to only retrieve the very first paragraph?

View 4 Replies View Related

Suspect Database - How To Retrieve And Repair

Apr 24, 2000

Running SQL 7, Standard version. I had a database marked 'suspect'. I copied the MDF and LDF files to another directory, then deleted the suspect database. I tried to create a new database and attach the MDF file to it. It did not work. Any other ideas? I have no other backups of the data. I am willing to pay for consulting over the phone if necessary.

View 1 Replies View Related

Save And Retrieve RTF TEXT FROM SQL DATABASE

Jul 18, 2007

Hi,
i have a richtextbox control in my application, and want to know how to save and retrieve formatted text in a MS SQL DB.

I found this example in the forum, but I don't know how to use it. Can you please help me solve the problem? Where should I write the code below?





I've just tried it and able to do this successfully.

I basically did this:
load the RTF into the RTB control
created a SQL command, simple basic insert statement:











SqlCommand theSQLCommand = new SqlCommand("INSERT INTO [TableName] (Field) VALUES (@p1)");
SqlParameter theSQLParameter = new SqlParameter("@p1", SqlDbType.Text);
theSQLParameter.Value = this.theRichTextBox.RTF;
theSQLCommand.Parameters.Add(theSQLParameter);
theSQLCommand.Connection = new SqlConnection(ConnectionString);
theSQLCommand.Connection.Open();
theSQLCommand.ExecuteNonQuery();
theSQLCommand.Connection.Close();





then to retrieve it, I did this, again, specifically for this example











this.theRichTextBox.Text = String.Empty;
SqlCommand theSQLCommand = new SqlCommand("SELECT [Field] FROM [TableName] WHERE [ID] = 1");
theSQLCommand.Connection = new SqlConnection(ConnectionString);
theSQLCommand.Connection.Open();
SqlDataReader theReader = theSQLCommand.ExecuteReader(CommandBehavior.CloseConnection);
while (theReader.Read())
{
this.theRichTextBox.RTF = theReader.GetValue(0).ToString();
}
theSQLCommand.Connection.Close();





And was able to do this fine and got all the formatting etc... correctly.

View 1 Replies View Related

Sending Uploaded Image To Data Access Class When Storing Image In SQL Server 2005

Apr 20, 2007

I am using the 3-tiered architecture design (presentation, business laws, and data acess layers). I am stuck on how to send the image the user selects in the upload file control to the BLL and then to the DAL because the DAL does all the inserts into the database. I would like to be able to check the file type in the BLL to make sure the file being uploaded is indeed a picture. Is there a way I can send the location of the file to the BLL, check the filetype, then upload the file and have the DAL insert the image into the database? I have seen examples where people use streams to upload the file directly from their presentation layer, but I would like to keep everything seperated in the three classes if possible. I also wasn't sure what variable type the image would be in the function in the BLL that receive the image from the PL. If there are any examples or tips anyone can give me that would be appreciated.

View 2 Replies View Related

How To Store An Image On To My SQL Database?

Aug 13, 2006

How to store an image on to my SQL database from the web form? Please guide me through. Thank you.

View 1 Replies View Related

Image Hyperlink In Sql Database

Aug 17, 2006

Hi,
I want to store an image hyperlink in a sql database but don't seem to be able to do it..is this do-able?
I can store a hyperlink in text format, no problem, but how do I do the same with an image?
I want to use images in my images folder. I can create an image field and set the required options to display images all that is pretty straight forward but trying to display the image as a hyperlink ( actually it's a mailto: link I want to use) seems not to be an option.
The purpose of this is to allow users to upload an image together with their email address and when other users click on the image it fires up their email app. I do not want to have to use a text link.
Thanks

View 2 Replies View Related

Uploading Image To Database

Nov 4, 2006

I'm trying to upload an image to a database along with some other info. I have a form to get all the info from the user that I want to put in the database. Everything's getting into the database except for the actual image data. When I do a "select * from table" query on the database, the Image field reads "err", however I have an imagetype field in the db and it reads "image/jpeg". I have the following code to get the image into the database:

View 2 Replies View Related

How To Add An Image To An SQL Server Database

Jan 22, 2007

Hi all,
I have a field in the SQL Server database, with 'Image' ad field type.
How can I add a jpeg fiel to it so that I can view it and also access it through a program?
Thanks
Tomy

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved