Click here to Skip to main content
15,041,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to upload photo or image using textbox,button and image control, i struck at writing code
at
string query =insert into enquirytable values("'" +TxtPhoto.Text+"'");

for a insert query what i write txtphoto.? for photo to store in database, and
create table called enquirytable in that i gave image datatype as binary

pls help me out; i think below sorce code of my page design will help u ......
HTML
<form id="form1"  runat="server">
    <div align="center">
    
 <asp:Image ID="Imgstudent" runat="server" 
            Height="100px" Width="128px" />
     </div>
    <table class="style1">
        <tr>
            <td align="right" class="style3">
                Photograph</td>
            <td class="style2">
       <asp:TextBox ID="TxtPhoto" runat="server">
                            </td>
            <td>
   <asp:Button ID="BtnBrowse" runat="server" Font-Bold="True" Text="Browse" 
                                    Width="115px" />
     </td>
        </tr>
        <tr>
            <td class="style3">
                 </td>
            <td class="style2">
                 </td>
            <td>
                 </td>
        </tr>
    </table>
    </form>
Posted
Updated 9-Jul-11 3:02am
v2

Here is an article that cover the subject of image uploading from ASP.net to db

Save An Image Into SQL Server 2000 Database[^]
   
Comments
thatraja 9-Jul-11 15:13pm
   
5!
Google is your friend. A simple search on How to save an image in sql server returned 17.9 million results.
The first 4 links that appeared are below.
I would suggest that you need to learn to formulate simple and good search queries and use the power of google first.

Save An Image Into SQL Server 2000 Database[^]
Store or Save images in SQL Server[^]
http://www.shabdar.org/sql-server/105-store-save-images-in-sql-server.html[^]
http://www.vbdotnetheaven.com/UploadFile/scottlysle/ImageToSqlServer11242006025136AM/ImageToSqlServer.aspx[^]
   
Comments
Espen Harlinn 9-Jul-11 12:31pm
   
Nice links, my 5
thatraja 9-Jul-11 15:13pm
   
Good bunch 5. But my answer contains two methods for this task.
   
Comments
thatraja 9-Jul-11 15:13pm
   
5!
RaviRanjanKr 10-Jul-11 0:39am
   
Thank You :)
the fileupload tool in the toolbox may help you
   
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900