Using FileUpload To Store Image In SQL Database

Apr 24, 2008

Hi

I have a asp:FileUpload conponent that I am trying to use to retrieve a picture file from the clients pc and store it in a SQL database.

The table is called PropertyImage and it contains the following fields:

imgID (type = int - autoincrement); imgData (type = Image); imgTitle (type = VarChar); imgType (type = VarChar); imgLength (type = BigInt);

I have a button (Button1) which when clicked calls Button1_Click()

--------------------------------------------------protected void Button1_Click(object sender, EventArgs e)

{byte[] fileData = null;

Boolean status = false;if (FileUpload1 != null)

{

// Make sure the file has data.if ((FileUpload1.PostedFile != null) && (FileUpload1.PostedFile.ContentLength > 0))

{

// Get the filename.string fn = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);

try

{

// Access the file stream and begin the upload. Store the file in a memory byte array.Stream MyStream = FileUpload1.PostedFile.InputStream;

long iLength = MyStream.Length;fileData = new byte[(int)MyStream.Length];MyStream.Read(fileData, 0, (int)MyStream.Length);

MyStream.Close();

}catch (Exception ex)

{ }

}

}SqlConnection connection = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\heidihomes.mdf;Integrated Security=True;User Instance=True");

try

{

connection.Open();SqlCommand sqlCmd = new SqlCommand("INSERT INTO PropertyImage (imgData, imgaTitle, imgType, imgLength) VALUES(@data,@title,@type,@length)");

SqlParameter param = new SqlParameter();

// String connectionString = new SqlConnection(sqlCmd, connection);

 param = new SqlParameter("@data", SqlDbType.Image);

param.Value = fileData;

sqlCmd.Parameters.Add(param);param = new SqlParameter("@title", SqlDbType.VarChar);

param.Value = fileData;

sqlCmd.Parameters.Add(param);param = new SqlParameter("@type", SqlDbType.VarChar);

param.Value = fileData;

sqlCmd.Parameters.Add(param);param = new SqlParameter("@length", SqlDbType.BigInt);

param.Value = fileData;

sqlCmd.Parameters.Add(param);

sqlCmd.ExecuteNonQuery();

connection.Close();status = true;

}catch (Exception ex){ }if (status)

{

UploadStatus.Text = "File Uploaded Successfully";Server.Transfer("Admin_PropertyView.aspx");

}

else

{UploadStatus.Text = "Uploaded Failed";

}

}

}

--------------------------------------------------

But when I click on the button, nothing happens.

Please could someone help me out here.  I have tried this a few times and still haven't come right.

Also, if there is something else wrong with the code, please let me know.

Thanking you in advance.

View 9 Replies


ADVERTISEMENT

Store Files In SQL From An ASP Page Using FileUpload

May 23, 2008

I am almost done with a simple page to have a user select a file (using the FileUpload object), give it a short description and associate it with an item from a listbox.  Thensave these pieces of data to a new row in a SQL DB.
My issue... 
The SQLSmd.ExecuteNonQuery FAILS...
I have got all the fields able to connect and almost save... but for the actual "document" field errors out.  The user can select any type of file (image, word, excel, Powerpoint, etc) for storage into the DB.  I am not storing a referance to a file or the path to a file but the actual file in SQL.In the DB I have the field (Document) set to a type of VarBinary(8000) in the table.  Here is thethe corrisponding code in my app... 
Dim bArray As Byte...bArray = FileUpload1.PostedFile.InputStream.ReadByte()... SQLCmd.Parameters.Add("@Document", Data.SqlDbType.VarBinary, 8000).Value = bArray...iReturn = SQLCmd.ExecuteNonQuery()
ERRORThe first section of the stact trace...
[InvalidCastException: Invalid cast from 'System.Byte' to 'System.Byte[]'.]   System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) +867   System.Byte.System.IConvertible.ToType(Type type, IFormatProvider provider) +37   System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +408   System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +896

View 7 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

Store Image Object Into Database????

Feb 1, 2005

Hi,

How to insert image into database?Anyone know how to do this, please kindly lead me and give me the solution to solve this problem. Thanks a lot.

p@ywen

View 5 Replies View Related

How Can I Store Image (.jpg , .gif) In A Database (SQL SERVER)

Jan 27, 2006

hi to all !!!!
i want to store the image file from user click in SQL Server , so how can i ??
How can i Store image (.jpg , .gif) in a database .
pls send me Code or any thing which helps me ...

View 1 Replies View Related

How To Upload A Image And Store Into Database And Retrive

Jan 21, 2008

I am using FileUpload method in tools box and i want to store the uploaded image into database.
but when debuging it will shows an error like: Operand type clash: sql_variant is incompatible with image
this is the code for "upload" button.Protected Sub uploadbtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uploadbtn.Click
If FileUpload1.HasFile Then
TryFileUpload1.SaveAs("C: emp" & FileUpload1.FileName)
Label1.Text = "File name: " & FileUpload1.PostedFile.FileName & "<br>" & "File Size: " & FileUpload1.PostedFile.ContentLength & "kb<br>" & "Content Type: " & FileUpload1.PostedFile.ContentTypeCatch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString
End Try
Else
Label1.Text = "You have not specified a file"
End If
Try
SqlDataSource1.Insert()
Label2.Text = "picture is saved"Catch ex As Exception
Label2.Text = ex.Message.ToString
End Try
End Sub

View 3 Replies View Related

How Do I Store An Image/photo/picture In A Database?

Oct 24, 2000

How do I store an image/photo/picture in a database?

I have a database called database1 with a table called table1 like:

Table1:
Personid Name1 Name2 Address

and I want to stora a picture of the person in the database (SQL Sever 7) c:picture.jpg. How could I do that? I would like to use a stored procedure to do it. Something with BLOB?bulk insert? how does it work?

Thanks for you help!

//Carl

View 1 Replies View Related

How To Store Images In The Image Field In A Sql Server Database

May 6, 2008

hi can anyone tell how to use the image field and add an image in a database. i'm using visual studio web developer express edition 2008 and i want people who visit my website to be able to see the table and the images associated with some of the rows in the table
 
Thanx Taryn

View 2 Replies View Related

SQL Server 2014 :: How To Store The Image Located In Another System Into Local Database

Jan 12, 2015

I have the Image in FTP Server Folder and i need to insert that image into my local database.

How can i do this I tried with the below Query but i shows the errors as below.

--INSERT INTO AcademyStudents (ImageURL)
--SELECT BULKCOLUMN FROM OPENROWSET(BULK'https://iconic-solutions.net/OTA/test/images(1).jpeg',Single_Blob) AS BLOB
--Where StudentIdentificationNum = 2
--GO
GOt Error
;

Cannot bulk load because the file [URL] could not be opened. Operating system error code 123(The filename, directory name, or volume label syntax is incorrect.).

View 1 Replies View Related

How To Store Image In Image Field In Sql Server 2000

Jul 12, 2007



hi all,

i have created a table with image field in it. Now i just want to store a jpeg file in it but not finding any way to do so.



how can i store any image ? what are the steps???????





thanx in advance



View 5 Replies View Related

Uploading A File To A SQL Database Via A Typed Dataset And Using The FileUpload Control.

Oct 2, 2006

I am trying to upload a file in ASP.net 2.0 to a SQL database using the FileUpload control. I am doing this by way of a typed dataset.Here is my code.Dim rta As New ResponseTableAdapterDim rdt As ResponseDataTable = rta.GetResponseByID(1)Dim rr As ResponseRow = rdt(0)Dim fs As New FileStream(fu.PostedFile.FileName, FileMode.Open, FileAccess.Read)Dim br As New BinaryReader(fs)Dim image() As Byte = br.ReadBytes(fs.Length)br.Close()fs.Close()rr.UploadFile = imagerr.NameFile = fs.Namerta.Update(rdt)The code runs without an error but afterwards I find that nothing has been stored in the UploadFile cell in the database but the file name has been stored in the NameFile cell in the database. Any ideas?Your help is much appreciated. James 

View 1 Replies View Related

Datatype To Store Image...

Jul 4, 2006

Hello,
What's the datatype to be used to store an 'image'?
Lax

View 5 Replies View Related

How To Store Image Datatype Value To A Variable?

Aug 29, 2005

I have image type col.I'm trying to do the following,DECLARE @Data varbinary(16)SET @Data = (select imageCol from Table1 where id=3)As image datatype returns varbinary value, so I want to store image col value to a varbinary variable(or any other type variable, eg., varchar). But getting following error,========================================Server: Msg 279, Level 16, State 3, Line 2The text, ntext, and image data types are invalid in this subquery or aggregate expression.========================================Is there anyway to store image datatype value to a variable?Cheers.

View 2 Replies View Related

Store Image Data Type

May 2, 2006

Hi
when  I store html file with image in image data type of database sqlserver, where will actual data store (content of html file, and file image which display on html file), in which folder
Can I help you
 
 

View 4 Replies View Related

Store A Dataset In An Image Field Using SQL

May 15, 2002

Hi,

does anyone know a way, using native SQL, to store a result of a query in an image field of a certain table.

The case is we have a selfmade replication to communicate with several SQL servers in stores, this replication is over a telephone line. So we collect all the data using SQL statements and store them in a separate table as an image field. This is done know through a Delphi application that streams the resultset to a image field.

Thanks in advance,

View 1 Replies View Related

Store Documents In Image Field

Jul 20, 2005

I am creating a document management systems using asp. I have beenresearching the different ways of handling the documents such as using thefile system and storing the path in the db, and actually storing thedocument in the db. I like the idea of storing it in the database muchbetter because I can allow users to manage documents themselves (I alreadyhave the code in place to do it if I decide), having a central system withthe ability to add my own document properties by adding fields to the table,security, and backups. I have found that most think it is better to storethe path due to performance issues and the rate the db can grow. I havelooked at our current system in access and we have a total of 4400 documents(of which probably 25% are in the database but don't actually exist anymorein the file system, one hangup about the file system) since 1988. Thiscomes to about 300 documents added each year. The other thing is the issuewith the size of the db. I don't see a whole lot of difference with thisissue because it is going to take up space in your file system too, althoughthe file system may be more efficient at storing them. I would say that 95%of our docs are under 1 mb in size and done in ms word.The last thing is using full-text search capabilities in SQL Server. I needto be able to search the contents of the field.Is there other issues around storing documents in the db to consider besidesthe above?

View 1 Replies View Related

How To Store The Image Files In Sql Server 2000

Aug 9, 2007

I just want to store pic.bmp file in server using image datatype but don't getting how to do that ..
i want to know about both the actions storing and retrieving from the image data type..
like

create table amit
(
im image,
);


insert into values ()...
select * form Amit will it work...

View 6 Replies View Related

Converting Bytes [] To An SQL CE 3 Image Type To Store

Dec 31, 2005

Hi,

I was wondering if anyone knows how to convert an array of bytes to an SQL CE 3 image type and vice versa.

I am using the SDF Signature control and I would like to store the signature as an Image. It needs to be an image so it can be synced with a desktop access 2003 database.

Cheers

Simon

View 3 Replies View Related

Store Multi-Select Values In An Image Data Type?

Dec 20, 2005

I was working on figuring out where a certain application wasstoring the multiple selection choices I was doing through the app.I finally figured out that they were being store in an IMAGEdata type colum with the variable length of 26 bytes.This is the first time I ran into such way of storing multipleselections in a single Image data type.Is this a better alternative than to store into a One-to-Manytables? If so then I'll have to consider using the Image datatype approach next time I have to do something like storing1 to thousands of selections.Thank you

View 4 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

FileUpload

Apr 13, 2006

    I have gotten FileUpload in VB.Net to work fine in saving a file to a web server folder but cannot find some examples on how to save the file as an image on sql200.  Can anyone point me in the write direction - thanks.

View 3 Replies View Related

FileUpload Control And MS SQL

Jun 1, 2006

I am trying to use the FileUpload control to save a filename to a SQL database. I'm using the OnUpdating event for my SQLDataSource to add the filename to the UpdateParameters. The OnUpdating event is firing but the FileName doesn't get added to the database. Any pointers as to why that might be would be very helpful.
Here's the code. Thanks much.
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="File Upload Testing" %>
<script runat="server">
Sub Page_Load()
Response.Write("UpdateParameters(0)=" & dsLabel.UpdateParameters(0).Name & "<br />")
Response.Write("UpdateParameters(1)=" & dsLabel.UpdateParameters(1).Name & "<br />")
End Sub

Sub dsLabel_OnUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs)
Dim FileUploadControl As FileUpload = DetailsView1.FindControl("FileUpload1")
Dim strFileName As String = FileUploadControl.FileName
dsLabel.UpdateParameters(0).DefaultValue = strFileName
dsLabel.UpdateParameters(1).DefaultValue = Request.QueryString("rgstnID")
Response.Write("dsLabel.UpdateParameters(0).DefaultValue = " & dsLabel.UpdateParameters(0).DefaultValue & "<br />")
Response.Write("dsLabel.UpdateParameters(1).DefaultValue = " & dsLabel.UpdateParameters(1).DefaultValue & "<br />")
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1>File Upload</h1>
This page should allow me to use the FileUpload Control to save a filename to an MS SQL Database.<br />
<br />
&nbsp;<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="dsLabel" Height="50px" Width="125px">
<Fields>
<asp:TemplateField HeaderText="File" SortExpression="labelName">
<EditItemTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("labelName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<br />
<br />
<asp:SqlDataSource ID="dsLabel" runat="server"
ConnectionString="Data Source=FILESERVER1;Initial Catalog=IM;Integrated Security=True"
OnUpdating="dsLabel_OnUpdating"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT labelName FROM tblProductRegistration WHERE (registrationID = @registrationID)"
UpdateCommand="UPDATE tblProductRegistration SET labelName = @LabelName WHERE (registrationID = @registrationID)">
<UpdateParameters>
<asp:Parameter ConvertEmptyStringToNull="True" Name="LabelName" />
<asp:QueryStringParameter Type="Int64" Name="registrationID" QueryStringField="rgstnID" />
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter Name="registrationID" QueryStringField="rgstnID" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>

View 2 Replies View Related

SQL Server DB And Fileupload Control

May 22, 2008

I have a project that is using an exsisting SQL DB that stores uploaded files and images into the DB.
I am trying to figure out how to take the file from the fileupload control and place it into the DB field.
Almost all the examples I've seen deal specifically with images but I will not know what the file type is. It could be an image, a word doc, and excel file, a text file ect.
I thought to use a INSERT statement but I wonder if that will work.
I know that fileupload.postedfile.saveas saves the file to a directory you name but that does not help me. I thought I could just use the fileupload.contents property in the Parameter add statement but that must not be an option as I cannot find and example of that usage besides that would just be too easy I guess.
Any help or code would be accepted with great gratituide. I realize that this is not the best way for performance but it is what it is and I cannot scrap the old DB I just have to make it work.
Thanks,
Ty

View 7 Replies View Related

FileUpload Control And SQL Server 2005.

Aug 15, 2006

Hello,
I have a FileUpload control on my webform. I would like a user to be able to upload a file to the server. Is there any way to store this file in SQL Server 2005?
Thanks
ASPSQL66

View 1 Replies View Related

Fileupload Inside A CreateuserWizard Control ?

Sep 7, 2006

HiHoping someone can help me , I am looking to add a file upload inside a createuserWizard but am banging my head at this stage I can get in working saving the file selected in the Fileupload into  a table on the database using a datatype "image" for the field.However
ideally I would like to save a string of the file path to the database
and save the  actual file to the filesystem of the webserver.The
problem for me is that this is inside a CreateUserWizard, I gather the
standard information and them have "extended" the wizard  by adding
another wizard step , which will include a FileUpload control. I need
to invoke the FileUpload when the user select the createUser button of
the CreateUserWizard control( CreateUserWizard1_CreatedUser in the aspx.cs)  I
am able to write the SQL that  allows save information from a textbox
to a database tabel but not able to write the functionality to 1.Uplaod file to webServer when user selects Create User button 2. Save this path in a table on the database.I've tried loads but cannot get it to work I'm using C# for this.  here's a scaled down version of my code with just teh CreateUserWizard which contains the fileUploadaspx ( Contains a create user Wizard which inturn contains a Fileupload) <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="FORUMcreateuser.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server">    <title>Sign Up Page</title></head><body>    <form id="form1" runat="server" enctype="multipart/form-data">       
<atlas:ScriptManager id="MasterScriptManager"
EnableScriptGlobalization="false"
runat="Server"></atlas:ScriptManager>    <div>       
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
BackColor="White" BorderColor="#FFDFAD" BorderStyle='Solid'
BorderWidth='1px' Font-Names='Verdana' Font-Size='0.8em'
OnCreatedUser='CreateUserWizard1_CreatedUser'>            <WizardSteps>                <asp:WizardStep ID="CreateUserWizardStep0" runat="server">                    <table id="Table2" style='width: 100%'>                        <tr>                            <td style='color: blue'>                                <strong>Step 1 of 2</strong></td>                            <td style='color: white'>                                PlaceHolderBGColor</td>                            <td>                            </td>                        </tr>                        <tr>                            <td>                            </td>                            <td style='color: white'>                            </td>                            <td>                            </td>                        </tr>                        <tr>                            <td>                                First Name:</td>                            <td>                                <asp:TextBox runat="server" ID="txtFirstName" MaxLength="50" />                            </td>                            <td>                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator15" ControlToValidate="txtFirstName"                                     ErrorMessage="First Name is required." />                            </td>                        </tr>                        <tr>                            <td>                                Last Name:</td>                            <td>                                <asp:TextBox runat="server" ID="txtLastName" MaxLength="50" />                            </td>                            <td>                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator16" ControlToValidate="txtLastName"                                     ErrorMessage="Last Name is required." />                            </td>                        </tr>                        <tr>                            <td>                            </td>                            <td style='color: white'>                                PlaceHolderBGColor</td>                            <td>                            </td>                        </tr>                        <tr>                            <td>                                File:</td>                            <td>                                &nbsp;<asp:FileUpload ID="FileUpload1" runat="server" />                            </td>                            <td>                                &nbsp;</td>                        </tr>                        <tr>                            <td>                            </td>                            <td>                            </td>                            <td>                            </td>                        </tr>                    </table>                    <br />                </asp:WizardStep>                               <asp:CreateUserWizardStep ID="CreateUserWizardStep2" runat="server">                <ContentTemplate>                    <table>                        <tr>                            <th align="left" style='color: blue'>                                Step 2 of 2</th>                        </tr>                        <tr>                            <th align="left">                                MRS Login Details                            </th>                        </tr>                        <tr>                            <td>Username:</td>                            <td>                                <asp:TextBox runat="server" ID="UserName" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator9" ControlToValidate="UserName"                                     ErrorMessage="Username is required." />                            </td>                        </tr>                        <tr>                            <td>Password:</td>                            <td>                                <asp:TextBox runat="server" ID="Password" TextMode="Password" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator10" ControlToValidate="Password"                                     ErrorMessage="Password is required." />                            </td>                        </tr>                        <tr>                            <td>Confirm Password:</td>                            <td>                                <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator13" ControlToValidate="ConfirmPassword"                                     ErrorMessage="Confirm Password is required." />                            </td>                        </tr>                        <tr>                            <td>Email:</td>                            <td>                                <asp:TextBox runat="server" ID="Email" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator11" ControlToValidate="Email"                                     ErrorMessage="Email is required." />                            </td>                        </tr>                        <tr>                            <td>                                Recover Password Question:</td>                            <td>                                <asp:TextBox runat="server" ID="Question" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator12" ControlToValidate="Question"                                     ErrorMessage="Question is required." />                            </td>                        </tr>                        <tr>                            <td>                                recover Password Answer:</td>                            <td>                                <asp:TextBox runat="server" ID="Answer" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator14" ControlToValidate="Answer"                                     ErrorMessage="Answer is required." />                            </td>                        </tr>                        <tr>                            <td colspan="2">                                 <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"                                       
ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The
Password and Confirmation Password must
match."></asp:CompareValidator>                            </td>                        </tr>                        <tr>                            <td colspan="2">                                <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>                            </td>                        </tr>                    </table>                   
<asp:SqlDataSource ID="InsertExtraInfo" runat="server"
ConnectionString="<%$ ConnectionStrings:CONTACTSConnectionString
%>"                        InsertCommand="INSERT INTO [CLIENT]
([client_id], [First_Name], [Last_Name]) VALUES (@UserId, @FirstName,
@LastName)"                        ProviderName="<%$ ConnectionStrings:CONTACTSConnectionString.ProviderName %>">                        <InsertParameters>                           
<asp:ControlParameter Name="FirstName" Type="String"
ControlID="txtFirstName" PropertyName="Text" />                           
<asp:ControlParameter Name="LastName" Type="String"
ControlID="txtLastName" PropertyName="Text" />                        </InsertParameters>                                           </asp:SqlDataSource>                                    </ContentTemplate>                </asp:CreateUserWizardStep>                <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">                </asp:CompleteWizardStep>            </WizardSteps>            <NavigationButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle='Solid'                BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />            <HeaderStyle BackColor="#FFCC66" BorderColor="White" BorderStyle='Solid' BorderWidth='2px'                Font-Bold="True" Font-Size="0.9em" ForeColor="#333333" HorizontalAlign="Center" />            <CreateUserButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle='Solid'                BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />            <ContinueButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle='Solid'                BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />            <SideBarStyle BackColor="#990000" Font-Size="0.9em" VerticalAlign="Top" />            <TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />            <SideBarButtonStyle ForeColor="White" />        </asp:CreateUserWizard>    </div>    </form></body></html> aspx.cs using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class _Default : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {    }    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)    {        TextBox UserNameTextBox =            (TextBox)CreateUserWizardStep2.ContentTemplateContainer.FindControl("UserName");        SqlDataSource DataSource =            (SqlDataSource)CreateUserWizardStep2.ContentTemplateContainer.FindControl("InsertExtraInfo");        MembershipUser User = Membership.GetUser(UserNameTextBox.Text);        object UserGUID = User.ProviderUserKey;        DataSource.InsertParameters.Add("UserId", UserGUID.ToString());        DataSource.Insert();    }}  

View 1 Replies View Related

Granting Permission To Object In X Database From A Store Procedure In Y Database

May 16, 2000

I need to grant select, insert, update, and delete permission to an object residing in Database "X" from a store procedure in database "Y". I have already tried USE database statement. Any suggestion.
Thanks
Maroof Khan

View 1 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

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

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