|
Can anybody tell me how to retrieve a image from ms access 2003 and bind it to image control.. i hv retrieved image successfully in a new page. But want to bind it to Image control.
My code is as following :
Uploading to Ms access // This code works fine
Dim intImageSize As Int64
Dim strImageType As String
Dim ImageStream As Stream
intImageSize = File1.PostedFile.ContentLength
strImageType = File1.PostedFile.ContentType
ImageStream = File1.PostedFile.InputStream
Dim ImageContent(intImageSize) As Byte
Dim intStatus As Integer
intStatus = ImageStream.Read(ImageContent, 0, intImageSize)
Dim MyConnection As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\MyDataBase.mdb") & "")
Dim MyCommand As New Data.OleDb.OleDbCommand("INSERT INTO Images (ImageType,ImageData) VALUES (@ImgType,@img)", MyConnection)
Dim prImageType As New Data.OleDb.OleDbParameter("@ImgType", 255)
prImageType.Value = strImageType
MyCommand.Parameters.Add(prImageType)
Dim prImage As New Data.OleDb.OleDbParameter("@img", 255)
prImage.Value = ImageContent
MyCommand.Parameters.Add(prImage)
MyConnection.Open()
MyCommand.ExecuteNonQuery()
MyConnection.Close()
Retrieving Images from Msaccess
Dim MyConnection As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\MyDataBase.mdb") & "")
Dim MyCommand As New Data.OleDb.OleDbCommand("Select * from Images", MyConnection)
MyConnection.Open()
Dim myDataReader As Data.OleDb.OleDbDataReader
myDataReader = MyCommand.ExecuteReader()
' myDataReader = MyCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While (myDataReader.Read())
'Response.ContentType = myDataReader.Item("ImageType")
'Response.BinaryWrite(myDataReader.Item("ImageData"))
Loop
MyConnection.Close()
Thanks..
|
|
|
|
|
I think it is always better to store the file location of the image rather then the actual image itself in the database
We are not a Code Charity
|
|
|
|
|
You write a http handler that takes the id of the image on the URL, reads it from the DB and streams out it's bytes. Then you use URLs pointing to that handler for the URL of your image control
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
CG is absolutely correct i too did it in the same way
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
Anybody here know of a decent RTF to PDF converter for an ASP.Net C# WebApp? I need to generate a pdf from an rtf document without using word or a printer.
GhostScript can give me the PostScript, but even converting that requires a printer.
|
|
|
|
|
There are plenty about:
http://www.google.co.uk/search?hl=en&q=RTF+to+PDF+converter+for+an+ASP.Net+C%23&btnG=Search&meta=
try this one:
http://www.dot-net-search.com/c%23+code+for+converting+rtf+to+pdf/"
We are not a Code Charity
|
|
|
|
|
I need something that does not leave a watermark either. Thanks for the reply though.
|
|
|
|
|
Ah ok, sorry then I dont know, good luck
We are not a Code Charity
|
|
|
|
|
Thanks Anyway again! If I get this sorted, I will be sure to post a reply on the subject.
|
|
|
|
|
Still no solution to this problem and it is getting to be a real stress factor!!!
while(breathing)
{
eat();
sleep();
drinkbeer();
code();
drinksomemorebeer();
}
|
|
|
|
|
I want to access a folder from another system and i have used the ip address to map.
But i am unable to access the folder from my system.
I have used the code like
string Path="http://172.16.3.65/CustomPub-XML/CommomIndexes/CuPubIndex";
Does anybody know the solution.
Here the CustomPub-XML is a web shared folder and inside that i have two folders.
VanithaVasu
|
|
|
|
|
What error do you get?
You may not have the correct rights to access the system
We are not a Code Charity
|
|
|
|
|
Hi i am using ajax calendar..,
In that i like to enable present week dates only ...,
and it have to enable up to present date only...,
It mean example in this month dates:
1/6/2008 to 7/6/2008
8/6/2008 to 14/6/2008
15/6/2008 to 21/6/2008
22/6/2008 to 28/6/2008
29/6/2008 to 5/7/2008
And today date is 24/6/2008...,
So my calendar 22/6/2008 to 24/6/2008 dates only can enable true..,
all other dates have to enable false...,
how to do that...,
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
modified on Tuesday, June 24, 2008 4:48 AM
|
|
|
|
|
Write an if statement which checks today current date and then either take 2 away from that or add two to get all dates around the current date
example of date calculation
http://www.java2s.com/Code/ASP/Development/Datecalculationplus7daysC.htm
We are not a Code Charity
|
|
|
|
|
No i didnt ask add or minus from the given date...,
I asked based on current date it have to enable that week dates only...,
That also want to be enable up to current date only...,
Thats y i explained for example this month week dates like this 1 to 7 , 8 to 14 , 15 to 21 , 22 to 28 and 29 to 5
Now the current date is 24 so it have to enable 22 to 24 dates only...,
Suppose the current date is 20 thne it have to enable only 15 to 20...,
Plz give me some solution for this...,
Here i can add or minus dates..., based on current date have to enable only current week dates
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Yeah but by using add subtraction you can add or take seven days from the current date and get everything in between, that is why I was sending you down that route
We are not a Code Charity
|
|
|
|
|
Hi!
I have a dropdown that is bound to a datasource. The datasource is connected to an OracleReader. I select several fields and would to like display some of these fields in textboxes when I click on an item in the dropdown.
Is this possible without doing a separate select?
|
|
|
|
|
Sure - just pull the data out for the ones you want to show, and put them in the textboxes
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Can you illustrate this with a line of code?
I know how it's done in theory, but not the syntax. Can I go directly on the DataSource?
|
|
|
|
|
Try using the DropDown.SelectedValues method to get the values of the selected items then just assign those values to the textbox in which you wish to diplay them.
eg. textbox1.text = DropDown.SelectedValue.ToString();
"Sex is not the answer, it's the question and the answer is yes"
|
|
|
|
|
Thanks, but it's not the selected value I'm after.
Say that my query looks like this:
SELECT PERSON_ID,PERSON_NAME,PERSON_ADDRESS
FROM PERSON
ddlPerson is bound with this query. Value is PERSON_ID and PERSON_NAME is the displayfield.
When I select a person in the dropdown I would like to display PERSON_ADRESS in a TextBox.
|
|
|
|
|
You then use that selected person's id to access the database and retrieve the value as such:
int id = ddlPerson.SelectedValue.ToString()
UserInfo ui = con.GetUserByID(id);
tbPerson_Address.Text = ui.Person_Address;
Make sure that the people databound to the list are databound by their id value and this code should work just right.
"Sex is not the answer, it's the question and the answer is yes"
|
|
|
|
|
Sorry, don't convert to String.
"Sex is not the answer, it's the question and the answer is yes"
|
|
|
|
|
Thanks, but I was wondering if I could get the value directly from ddlPerson's DataSource somehow.
|
|
|
|
|
I am a beginner in asp.net. I am using sql database as a backend and asp.net with c# as frontend. Can anybody tell me how to save records in sql database through code.
|
|
|
|