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()

ERROR
The 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


ADVERTISEMENT

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

How To Access A .asp Page Or .aspx Page From A Store Procedure In Sql Server 2000

Sep 21, 2006

Hi, I wanted to know that can we access a webpagefrom a store procedure in sql server 2000 like we run a exe file from sql server. Bye.

View 1 Replies View Related

How To Code ASP.NET Page With Return Value Store Procedure?

Apr 12, 2005

Does anyone know how to call a SQL store procedure that return a value to the page?
I've a simple data entry aspx page with several textboxes and a save button. When user fill out the form and click save/submit, it calls a store procedure to insert a row into a SQL table and automatically generate an ID that need to return the the page to display for the user.
Are there a similar article somewhere?
 
Thank you all!

View 6 Replies View Related

Store Files In DB

Apr 26, 2004

Hi All,
I want to store files (any kind of file) in DB and retrieve them.What is the best method to do it and also please post sample code as I have never done that.
Thanks,
Kumar.

View 1 Replies View Related

How Can I Post Back A Statement From A Store Procedure To The .aspx Page

Oct 17, 2005

Hi all,Anyone can show me how can I catch the 'Print' statement that I have defined in my store procedure using SQL server 2000 DB on the .aspx page? ( I am using ASP.NET 1.0)My store procedure as follow:CREATE PROC NewAcctType(@acctType VARCHAR(20))ASBEGIN --checks if the new account type is already exist IF EXISTS (SELECT * FROM AcctTypeCatalog WHERE acctType = @acctType) BEGIN  PRINT 'The account type is already exist'  RETURN END
 BEGIN TRANSACTION  INSERT INTO AcctTypeCatalog (acctType) VALUES (@acctType)
  --if there is an error on the insertion, rolls back the transaction; otherwise, commits the transaction  IF @@error <> 0 OR @@rowcount <> 1   BEGIN    ROLLBACK TRANSACTION    PRINT 'Insertion failure on AcctTypeCatalog table.'    RETURN   END  ELSE    BEGIN    COMMIT TRANSACTION   ENDENDThanks for all your replies

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

Using Sql 7.0 To Store Tiff Files

Feb 22, 1999

Has anyone used sql 7 to store image data? Is it easy to load .tiff files into a sql database using the image datatype? If anyone knows how to do this, please reply.

Thanks !

View 2 Replies View Related

How Do I Store Flat Files

Oct 18, 2006

In my application I am allowing the users attach files. I found the data type "Image", Will this also allow regular file attachments?

Thanks,

Steve C.

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

How To Store Uploaded Files In An SQL Database?

Apr 11, 2007

Hi FriendsCan anyone tell me how to store uploaded files from the user to the SQL database and later give an option of downloading the file probably in the form of a GridView control. How do we write code to allow the user to download the uploaded files. I have written code to upload and store the files into a folder, however, I'm not able to collect data from the folder later and the folder is only accessible offline using the server system which I do not want to happen. Can anyone help me with this?Thanks 

View 1 Replies View Related

How To Store GIF,BMP,JPEG Files In SQLServer.

Jan 19, 2000

Hello friends,

Can anybody pls explain me how I can store GIF,BMP,JPEG files in SQLServer
using Image data type or anything else .Thanks in advance.

Rajesh George.

View 1 Replies View Related

Can We Store HTML/Word/PDF Files In SQL 6.5?

Apr 30, 1999

Hi all,

We've a requirement from our client for converting their paper documents
in electronic format. In order to do so, we need to know whether SQL Server
6.5 has a capability of storing documents in HTML or Word(6.0 or later) or PDF
format into the database?

Any help/link is highly appreciated.

Cheers,

Nimesh

View 2 Replies View Related

How Can I Store Flat Files In SQL SERVER??

Sep 25, 2005

How can I store flat files in SQL SERVER??

Actually I am planning to prepare a repository of different files like .xls, .pdf, .doc, .ppt etc and then i will have a web interface to access these files. Can anybody guide me, How can i store these flat files in datbase.

View 3 Replies View Related

How Store Video Files In Sql Database

Jan 24, 2008

how store video files in sql database.Also i want to know cording part

View 3 Replies View Related

Store FILES In SQL Express 2005 With VB.NET

Feb 8, 2007



Hi, I'm a beginner with VB.NET and SQL and I would like to store files (like Images, Document...) in a Table of SQL but I have no idea how to do it.

This is my connection string, and examples of how I do queries, please help me...



Private cn As New SqlClient.SqlConnection

Private cn2 As New SqlClient.SqlCommand

cn.ConnectionString = stringa

cn.Open()

cn2 .Connection = cncn2

CommandType = CommandType.Text



Dim ESEGUI As String

cn2 .CommandText = "INSERT INTO users (nickname) values ('Paolo')

ESEGUI = cn2 .ExecuteNonQuery()



Dim oDr As SqlClient.SqlDataReader

cn2 .CommandText = "SELECT * FROM users WHERE Nickname like 'Paolo'"

oDr = cn2 .ExecuteReader



Thanks

View 1 Replies View Related

Code Page Question (convert Squiggles To Korean And Chinese, Store In Nvarchar)

Jan 17, 2008

Hi all,

I spent about an hour searching the forums and the web but could not find a solution. Bob Bojanic, if you are around can you answer?


I have a DB that stores WW data for company names in a varchar

I don't have control over this DB, other than to pull data from it

I have an SSIS package that grabs WW data in a single pull using a system account

I have an Execute SQL task that runs a sproc to stage the data

I have a Data Flow Task that then copies the data to another server (where I need it)

The destination columns are nvarchar. The source columns are varchar.
Some countries (such as Korea and China) end up with ASCII gibberish (because of code page issues).

I have a solution that involves pulling the data, BCP the pulled data to a text file, then re-import with the correct code page, and delete the gibberish. BUT, I'd like to do this as part of the pull if possible (without any data duplication).

I've tried modifying the CodePage properties for both the Staging step (Execute SQL task running a sproc) and the Source & Dest columns for the Data Flow Task with no luck. Can anyone assist? Thanks much!

Brian

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

How Can I Store Files Like (abc.txt , Abc.doc) In SqlServer Database From ASP.NET Application

Jan 29, 2006

How can i Store files like (abc.txt , abc.doc) in SqlServer Database from ASP.NET application ?? my files are about (2 Mb ) size
aslo  want to know about text as well as .jpg , . gif files also
pls send me code ... help me
 

View 4 Replies View Related

Store And Receive Html Files In SQL Server

May 1, 2006

I have html files which want to store in database SQL Server with data type image. How store and receive html file from database SQL Server by ASP.NET.
Data type image is pointer 16 bit to file html. So where will content of files html with their image store ?
Can I help you.

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

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

How To Store Flash Files Into The Sql Server 2000 Database

Mar 1, 2008

Hi

How to store flash files into the sql server 2000 database and again display them back in asp.net/C# user interface?thanks 

View 1 Replies View Related

Script To Store Stored Procedures In Seperate Files

Jul 20, 2005

How does MicroSoft store the stored procedures in seperate files.What tools are used.Cause that's what I like to do too.Arno de Jong,The Netherlands.(SCPTFXR does not have the option to store the stored procedures indifferent filesI think)

View 2 Replies View Related

Exporting Files In The ReportViewer.aspx Page

Mar 25, 2008

I am needing to export some files in landscape when I select the PDF option in the dropdown on the ReportViewer.aspx page. How do I do this?

View 1 Replies View Related

SQL 2012 :: Setup FCI With NetApp Fileshare To Store Data Files

Jun 8, 2015

I recently set up a SQL 2012 FCI with a NetApp fileshare to store the data files. The install worked just fine, but I can't run an integrity check for any of my databases. Whenever I try, I get these error messages:

Msg 1823, Level 16, State 2, Line 1
A database snapshot cannot be created because it failed to start.
Msg 1823, Level 16, State 8, Line 1
A database snapshot cannot be created because it failed to start.
Msg 5120, Level 16, State 104, Line 1
Unable to open the physical file "path-to-fileshareMSSQL11.MSSQLSERVERMSSQLDATAmodel.mdf:MSSQL_DBCC12". Operating system error 1: "1(Incorrect function.)".
Msg 7928, Level 16, State 1, Line 1

The database snapshot for online checks could not be created. Either the reason is given in a previous error or one of the underlying volumes does not support sparse files or alternate streams. Attempting to get exclusive access to run checks offline.The error message suggests SQL had a problem creating the snapshot, but I checked through some NetApp documentation for configuring SMB 3.0 for SQL.

View 3 Replies View Related

DB Design :: Can Use Another Server / Disk To Store Files Using FileTable Concept?

May 11, 2015

I tried samples of FileTable in SQL Server 2012 to store files in database. I have following questions.

1. When I right click on FileTable, and say Explore File Table Directory, I was taken to a directory. But if I search the same directory in my server/machine, the directory is not available.

2. Can I use some external server/disk as a directory for FileTable?

3. How easy is to use FileTables using .Net web applications?

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

Integration Services :: How To Download Files From Web Page Before Loading Into Server

Oct 26, 2015

How to download files from a webpage before loading into SQL Server tables? I have the following URL and under the Downloads & Resources section, I have different file formats.

By doing hover on the download tab for each file type, I see that there is a link that is associated with it just like the following:

For CSV - [URL] ....
For XML - [URL] ....

The above is just an example for your reference/understanding. In the sample data from the internal website I have, I need to do a similar operation. The only difference would be that I would be having multiple XLS files with a description for each.

Example:
Sales Q1 - <xls download tab>
Sales Q2 - <xls download tab>
Sales Q3 - <xls download tab>
Sales Q4 - <xls download tab>

<li>
<sub>Sales for Calendar Year 2015--All Countries </sub>
<a href="/Data/Downloads/Documents/Sales/Sales_Quarter1.xlsx">
<sub>[XLS]</sub></a><sub> , <a href="/Data/Downloads/Documents/Sales/Sales_Quarter1.pdf"><sub>[PDF]</sub></a><sub>​</sub></sub>
</li>

I need to download the file based on the month/quarter every time.

View 7 Replies View Related

Asp.net Page Is Unable To Retrieve The Right Data Calling The Store Procedure From The Dataset/data Adapter

Apr 11, 2007

I'm trying to figure this out
 I have a store procedure that return the userId if a user exists in my table, return 0 otherwise
------------------------------------------------------------------------
 Create Procedure spUpdatePasswordByUserId
@userName varchar(20),
@password varchar(20)
AS
Begin
Declare @userId int
Select @userId = (Select userId from userInfo Where userName = @userName and password = @password)
if (@userId > 0)
return @userId
else
return 0
------------------------------------------------------------------
I create a function called UpdatePasswordByUserId in my dataset with the above stored procedure that returns a scalar value. When I preview the data from the table adapter in my dataset, it spits out the right value.
But when I call this UpdatepasswordByUserId from an asp.net page, it returns null/blank/0
 passport.UserInfoTableAdapters oUserInfo = new UserInfoTableAdapters();
Response.Write("userId: " + oUserInfo.UpdatePasswordByUserId(txtUserName.text, txtPassword.text) );
 Do you guys have any idea why?
 
 

View 6 Replies View Related

Reporting Services :: All Record Are Displaying On One Page - How To Display Page By Page

Nov 11, 2015

I have created one reports but all the records are displaying on one page.find a solution to display the records page by page. I created the same report without group so the records are displaying in page by page.

View 3 Replies View Related

I Need To Pass Data Entered /created On The First Page To The Next Page And Populate The Next Page With Some Data From The Fir

Nov 28, 2006

Hello I have a project that uses a large number of MS Data access pages created in Access 2003 and runs on MS SQL2005.

When I am on lets say my client, (first page in a series) data access page and I have completed the fields in the (DAP), I am directing my users to the next step of the registration process by means of a hyperlink to another Data access page in the same web but in a linked or sometimes different table.


I need to pass data entered /created on the first page to the next page and populate the next page with some data from the first page / table. (like staying on the client name and ID when i go to the next page)


I also need the first data access page to open and display a blank or new record. Not an existing record. I will also be looking to creata a drop down box as a record selector.


Any pointers in the right direction would be appreciated.
I am some what new to data access pages so a walk through would be nice but anything you got is welcome. Thanks Peter€¦

View 2 Replies View Related







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