SQL CONNECTION - INSERT - RETRIEVE ID - Rename File - UPLOAD FILE

Sep 15, 2007

Hi there,

I have inherited a databse and am building a new website to go wiht it.

There is a file upload page which will upload images to a directory.  I need to insert into the database retrieve the id just added then upload the image renaming it in the format locID(QueryString)_ImageID(retrieved from database).jpg

The page has a file upload control and a button.

I am trying to write my code behind so that when the button is clicked it inserts location id into the images table retrieves Image id. Renames the file and uploads it to the images folder.

II think i need to call the routine from another routine for the button click but the signatures are different, where am i going wrong? or for that matter have i been pissing into the wind for the last 4 hours?

CODE BEHIND


Imports System.Data

Imports System.Data.SqlClientPartial Class admin_Add_Images

Inherits System.Web.UI.PageProtected Sub UploadImage(ByVal Sender As Object, ByVal e As SqlDataSourceStatusEventArgs)
Dim LocationId As String = Request.QueryString(ID)


' create a new SqlConnectionDim NewConn As New SqlConnection

NewConn = New SqlConnection("server=desktopsqlexpress;uid=xxxxxx;pwd=xxxxxxx;database=MYLOCDEV") 'OleDbConnection i

' open the connection

NewConn.Open()Dim MyInsert = New SqlCommand("INSERT into image([LocationID]) VALUES (@LocationID); SET @NewId = Scope_Identity()")

NewConn.Close()

If Not File1.PostedFile Is Nothing And File1.PostedFile.ContentLength > 0 Then

'RENAME THE FILEDim newid As Integer = e.Command.Parameters("@NewId").Value

Dim fn As String = (LocationId & "_" & newid & ".jpg")Dim SaveLocation As String = Server.MapPath("oicImages") & "" & fn

Try

File1.PostedFile.SaveAs(SaveLocation)Response.Write("The file has been uploaded.")

Catch Exc As ExceptionResponse.Write("Error: " & Exc.Message)

End Try

ElseResponse.Write("Please select a file to upload.")


End If

End SubProtected Sub Submit1_Click(ByVal Sender As Object, ByVal e As System.EventArgs) Handles Submit1.Click


UploadImage()End Sub

End Class

View 2 Replies


ADVERTISEMENT

How To Insert And Retrieve Data From MDF File

Dec 10, 2011

I want to use sql server as a back end for my asp.net shopping cart using vb.net..i have created an "news.mdf" under app_data folder of my website in visual studio2010...but i tried to connect it to database using below command...but showing error...

sqlconnectionstring = "Data Source=.SQLEXPRESS;attachdbfilename=App_Datamyd atabase_data.mdf;Integrated Security=true;User Instance=true"
myconnection.ConnectionString = sqlconnectionstring
insertstring = "insert into News_table values(@N_head,@n_contents); "
mycommand = New SqlCommand(insertstring, myconnection)

[Code] ....

How to fix this error..and how to display this data in my site also

View 1 Replies View Related

Help Getting Error When Using Operation Rename A File In The File System Task Editor?

Aug 18, 2006

Does anyone know how to do this using variables?  Everytime I try it, I get the

Error: Failed to lock variable for read access with error 0xc00100001. 

 I also tried it writing a script and still the same error.  If I hard code the values into the variables it works fine but I will be running this everday so that it will pull in the current date along with the filename.  So the value of the variables will change everyday.  Here is my expression:

@[User::Variable] +(DT_WSTR,4) YEAR( GETDATE() )+"0"+(DT_WSTR,2) MONTH( GETDATE() ) + (DT_WSTR,2) DAY( GETDATE() )

The result:

C:Documents and SettingsmroushDesktopOSU20060818

the 20060818 part will change everyday ie.(tomorrow will be 20060819, next day 20060820 and so on.)

 

View 6 Replies View Related

Adding File Information To SQL Database On File Upload

Apr 18, 2004

Hi there :)

I'm in the final stage of my asp.net project and one of the last things I need to do is add the following file information to my SQL server 2000 database when a file is uploaded:

First of all I have a resource table to which I need to add:
- filename
- file_path
- file_size
(the resource_id has a auto increment value)

so that should hopefully be straight forward when the file is uploaded. The next step is to reference the new resource_id in my module_resource table. My module resource table consists of:
- resource_id (foreign key)
- module_id (foreign key)

So, adding the module_id is easy enough as I can just get the value using Request.QueryString["module_id"]. The bit that I am unsure about is how to insert the new resource_id from the resource table into the module_resource table on file upload. How is this done? Using one table would solve the issue but I want one resource to be available to all modules - many to many relationship.

Any ideas?

Many thanks :)

View 1 Replies View Related

Move And Rename File With File System Task

Jul 12, 2006

Hello

I want to move and rename a file and embed the date/time into it, so that each time the package runs a new file is created. For example MyFile_20060712_150000.doc.

Can someone give me a hint how to do this with the File Systen Task SSIS Control Flow Item?

Thanks for an early reply

Regards

Chaepp

View 12 Replies View Related

Rename File Using File System Task Editor

Jul 13, 2006

Could someone please instruct me on how to use the File System Task Editor to rename a file? I place control on control flow tab, change the operation to rename, from there I am not sure what to do.

View 29 Replies View Related

How To Rename The File Using File System Task.

Mar 19, 2007

Hi there,

Can some one tell me how to rename the file Dynamically using file system Task.

I could able to rename the file and couldnt do it dynamical renaming.

Please let me know if anyone have an idea.



Thanks and Best Regards

View 3 Replies View Related

Integration Services :: Unable To Retrieve Column Information From Flat File Connection Manager

Jul 15, 2015

I've developed a package that is working well at development machine from VS 2013 for a sample flat file. Also, over development machine, I've deployed it to SSISDB catalogue and even from there also it is running well for the same file.When the same package is deployed to production server's SSISDB catalogue database, it throws following error while processing the same sample flat file, “Unable to retrieve column information from the flat file connection manager”

View 5 Replies View Related

File Connection Act Differently Than Flat File Connection For Expressions?

Jun 26, 2007

I am thinking I must be doing something wrong..



I have dozens of packages that work as follows (high level... not listing all the steps just those relevant to this question)



- Get list of files in directory

- Join list to list of already imported files

- Those not imported put into an ADO.Net object

- Loop through ADO.Net record (which contains the filename) and import each file.



I just set the connection string of the flat file to be the variable in the loop (expressions.. connection string). Pretty standard stuff. Now I tried to do the same with a file connection (not a flat file) becuase I have a source that is from a mainframe and I had to write a custom source script and its not working. Basically the source script uses

oRead = oFile.OpenText(Me.Connections.FileConnection.ConnectionString)

And it opens the same file over and over (not ever changing as the ConnectionString expression changes like it does for flat files) and imports it even though I have verified the loop is correctly looping through all the different files.



Any thoughts as to what I am doing wrong?

View 3 Replies View Related

File Upload Help

Dec 11, 2007

Hi, I am trying to upload a file to database.
I have used the following code, every loads good to the database apart from the image, does it go anywhere?
I have created a column in the table called 'FileUploadAdvert' and made it an image?
Any ideas where I'm going wrong?
ThanksGordon 
Protected Sub btnAdvertSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdvertSubmit.ClickDim dashDataSource As New SqlDataSource()dashDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("DashConnectionString1").ToString()
dashDataSource.InsertCommandType = SqlDataSourceCommandType.Text
dashDataSource.InsertCommand = "INSERT INTO tblAdvert (AdvertOwner, AdvertName, TopLeftH, TopLeftV, Height, Width, ToolTip, WebLink, AcceptTerms, DateTimeStamp, IPAddress) VALUES (@AdvertOwner, @AdvertName, @TopLeftH, @TopLeftV, @Height, @Width, @ToolTip, @WebLink, @AcceptTerms, @DateTimeStamp, @IPAddress)"dashDataSource.InsertParameters.Add("AdvertOwner", txtName.Text)
dashDataSource.InsertParameters.Add("AdvertName", txtCompName.Text)dashDataSource.InsertParameters.Add("TopLeftH", DropDownAccross.Text)
dashDataSource.InsertParameters.Add("TopLeftV", DropDownDown.Text)dashDataSource.InsertParameters.Add("Height", DropDownHeight.Text)
dashDataSource.InsertParameters.Add("Width", DropDownWidth.Text)dashDataSource.InsertParameters.Add("ToolTip", txtOver.Text)
dashDataSource.InsertParameters.Add("Weblink", txtURL.Text)dashDataSource.InsertParameters.Add("AcceptTerms", CheckBoxAgree.Checked)
dashDataSource.InsertParameters.Add("IPAddress", Request.UserHostAddress.ToString)dashDataSource.InsertParameters.Add("DateTimeStamp", DateTime.Now)
If Not FileUploadAdvert.PostedFile Is Nothing ThenDim filepath As String = FileUploadAdvert.PostedFile.FileName
Dim pat As String = "\(?:.+)\(.+).(.+)"Dim r As Regex = New Regex(pat)
'runDim m As Match = r.Match(filepath)
Dim file_ext As String = m.Groups(2).Captures(0).ToString()Dim filename As String = m.Groups(1).Captures(0).ToString()
Dim file As String = filename & "." & file_ext
'save the file to the server FileUploadAdvert.PostedFile.SaveAs(Server.MapPath(".") & file)
lblStatus.Text = "File Saved to: " & Server.MapPath(".") & fileEnd If
 Dim rowsAffected As Integer = 0
Try
rowsAffected = dashDataSource.Insert()Catch ex As Exception
Server.Transfer("Register_Fail.aspx")
Finally
dashDataSource = Nothing
End Try
If rowsAffected <> 1 ThenServer.Transfer("Register_Fail.aspx")
ElseServer.Transfer("Register_Complete.aspx")
End If
End Sub

View 4 Replies View Related

File Upload To SQL In 2.0 VB

May 2, 2006

Can anyone give me an example of how to Upload a file to SQL in asp.net 2.0 using VB?
 
Thanks
Randy

View 2 Replies View Related

Upload File

May 5, 2008

Hello

I am using Microsoft SQL Server Management Studio Express and want to insert a row into a table. The table (Pictures) has the following columns: ID (int), Filename (varchar), Data (varbinary).

INSERT INTO Pictures(ID, Filename, Data) VALUES
(12, 'photo.jpg', C:photo.jpg);


The statement above does not work. How do you do it?

Thank you

View 1 Replies View Related

Rename Dos File Name

Oct 1, 2004

Just a shoot in the dark here...

When SQL Server exports procs to individual files, it creatin them like

dbo.sproc.prc

Needless to say this filename is causing fits...

I've tried to do a rename to no avail

any suggestions?

View 2 Replies View Related

Rename A File

Jan 11, 2006

Hello,

I have a DTS process to import data from txt file to the sql.
The File name I import is LLEEOD.txt

and the directory is from a d:ftpewdata

When my import process completes, I have to rename that file to the current date, lets say 01-11-2006.txt

I was trying to create another DTC (txt to txt) , but I have to provide a name myself. which is a problem, since this is a weekly process.

Is there are other ways to rename the txt file>


Thank you very much.

View 3 Replies View Related

Store A File Upload Into DB

Sep 10, 2007

Can someone please direct me to a discussion on which version of SQL Server allows a file to be stored in a db field and how this is accomplished as well as how the file is then retrieved with asp.net VB from the DBthanksMilton

View 16 Replies View Related

Upload File Only Works For Dbo

Nov 6, 2007

Hi there,
My problem is that the upload works in testing for our asp.net site only for dbo. Being mindful of security, I would prefer not use this account to execute all sp_/sql. One solution could be using impersonation only in the content management system where the uploading is done, this is code in web.config:
  <location path="Manage.aspx">    <system.web>    <identity impersonate="true" userName="dbo" password="****" />      <authorization>        <deny users="?" />      </authorization>    </system.web>  </location>
To do this I would have to change the dbo password as set up by previous employee, not a real dba so not sure of the implications (enough permissions to be dangerous though;). Is the above impersonation ok, or should I redo logins security in sql? Thanks.

View 1 Replies View Related

Upload .xls File To SQL Server

Aug 9, 2005

Here's what I have to do:1. Allow user to locate a .xls file on their machine2. Upload this .xls data into an existing table on a remote SQL ServerI can pull the file from my local machine to another directory on the local machien, but can't figure out have to configure the saveas() to save on the remote db server.It seems you have to save the the db server first on the hard drive, then you can insert the .xls file data into the table.Here's my code so far that works to save on the local machine to another directory on that local machine:Dim getmyFile As HttpPostedFile = myfile.PostedFileIf IsNothing(getmyFile) ThenLabel2.Text = "Please select a file to upload"ElseIf getmyFile.ContentLength = 0 ThenLabel2.Text = "Cannot upload zero length File"ElseDim ServerFileName As String = Path.GetFileName(myfile.PostedFile.FileName)getmyFile.SaveAs("C:TestSaving" & ServerFileName)Label2.Text = "Successful upload to C:TestSaving" & ServerFileNamesCon1.Open()Dim strSQL As StringDim err As IntegerstrSQL = "Insert into ActivityTest Select * FROM OPENROWSET"strSQL &= "('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D: esting.xls;"strSQL &= "HDR = YES ','SELECT * FROM [Sheet1$]')"Label3.Text = strSQL.ToString()Dim cmd As New SqlCommand(strSQL, sCon1)Trycmd.ExecuteNonQuery()err = "Select @@Error"If err <> 0 ThenLabel4.Text = err.ToString()ElseLabel4.Text = "No Error...line 91!"End IfCatch ex As ExceptionLabel2.Text = "Line 82 Error Updating Table: "Label2.Text &= ex.MessageFinallysCon1.Close()End TryEnd IfThanks for the help in advance!!!!

View 1 Replies View Related

Cannot Upload File To Database

Mar 16, 2006

  Can anyone correct my code?I will like to add a url to my database and upload my image to web server.txtAddTitle will become my title nametxtFileName allow user to type in image name that will upload to webserver and at the meantime will insert into database as url referencesvalue for @chapterid will get from drop down list(ddlLesson) and the index value will store in database.
now i am able to upload my images with the file name that i have given to web server, but I am unable to insert data to my database.
 Sub DoUpload(ByVal Sender As Object, ByVal e As System.EventArgs)        Dim sPath As String        Dim sFile As String        Dim sFullPath As String        Dim sSplit() As String        Dim sPathFriendly As String
              'Upload to same path as script. Internet Anonymous User must have write permissions        sPath = Server.MapPath("../Tutorial")        'sPath = Server.MapPath(".")        If Right(sPath, 1) <> "" Then            sPathFriendly = sPath 'Friendly path name for display            sPath = sPath & ""        Else            sPathFriendly = Left(sPath, Len(sPath) - 1)        End If
        'Save as same file name being posted        'The code below resolves the file name        '(removes path info)        sFile = txtFileName.Text        'sFile = txtUpload.PostedFile.FileName        sSplit = Split(sFile, "")        sFile = sSplit(UBound(sSplit))
        sFullPath = sPath & sFile        Try            txtUpload.PostedFile.SaveAs(sFullPath)            lblResults.Text = "<br>Upload of File " & sFile & " to " & sPathFriendly & " succeeded"
        Catch Ex As Exception
            lblResults.Text = "<br>Upload of File " & sFile & " to " & sPathFriendly & " failed for the following reason: " & Ex.Message        Finally            lblResults.Font.Bold = True            lblResults.Visible = True        End Try
        Dim mycommand As SqlCommand        Dim myConnection As SqlConnection        Message.InnerHtml = ""        'to all the valur to database        If IsValid Then
            myConnection = New SqlConnection("Server=localhost;UID=sa;pwd=;database=u")            mycommand = New SqlCommand("INSERT INTO t_linkTitle(link_chapterid,link_name,link_url) VALUES (@chapterid,@titleName,@titleUrl)", myConnection)
            mycommand.Parameters.Add("@chapterid", SqlDbType.VarChar, 50).Value = ddlLesson.SelectedItem.Value            mycommand.Parameters.Add("@titleName", SqlDbType.VarChar, 50).Value = txtAddTitle.Text            mycommand.Parameters.Add("@titleUrl", SqlDbType.VarChar, 100).Value = txtFileName.Text
            mycommand.Connection.Open()            msgErrorTitle.Style("color") = "OrangeRed"            Try                mycommand.ExecuteNonQuery()                msgErrorTitle.InnerHtml = "New title <b>" + txtAddTitle.Text + "</b> Added to " + "<b>" + ddlLesson.SelectedItem.Text + "</b><br>" + mycommand.ToString()            Catch Exp As SqlException
                If Exp.Number = 2627 Then                    msgErrorTitle.InnerHtml = "ERROR: Title already exists. Please use another title"                Else                    msgErrorTitle.InnerHtml = "ERROR: Could not add record, please ensure the fields are correctly filled out"                End If
            End Try
            mycommand.Connection.Close()        End If
        LoadTitle()
    End Sub

View 2 Replies View Related

Upload File To A DB In Binary

Apr 20, 2006

Hi have done the following but get the errors at the end, any ideas
 Created a stored procedureALTER PROCEDURE ulfile@upload varchar(200)ASINSERT INTO results(@upload)VALUES (@Upload)RETURN after sitting for two hours I realised I had a comma after (200) then the following in the .cs file using System;using System.Data;using System.Configuration;using System.Collections;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 Default3 : System.Web.UI.Page{//PostedFile Property of Type HTTPPostedFileint intDocLen = txtFileContents.PostedFile.ContentLength;byte[] Docbuffer = new byte[intDoclen];protected void Page_Load(object sender, EventArgs e){ Stream objStream;//InputStream://Gets a Stream object which points to an uploaded Document; //to prepare for reading the contents of the file.objStream = txtFileContents.PostedFile.InputStream;objStream.Read(Docbuffer, 0, intDocLen);//results is the connection objectcmdUploadDoc = new SqlCommand("ulfile", results);cmdUploadDoc.CommandType = CommandType.StoredProcedure;//Add the Params which in the Stored Proc cmdUploadDoc.Parameters.Add("@upload ", SqlDbType.VarChar, 200);//Set Params ValuescmdUploadDoc.Parameters[0].Value = txtTitle.Text;//Set the "@Doc" Param to be Docbuffer byet ArraycmdUploadDoc.Parameters[1].Value = Docbuffer;cmdUploadDoc.Parameters[2].Value = strDocType; }private void btnSubmit_Click(object sender, System.EventArgs e){string strDocExt;//strDocType to store Document type which will be Stored in the Databasestring strDocType;//Will be used to determine Document lengthint intDocLen;//Stream object used for reading the contents of the Uploading DocumnetStream objStream;SqlConnection results;SqlCommand cmdUploadDoc;if(IsValid){if(txtFileContents.PostedFile != null){//Determine File TypestrDocExt = CString.Right(txtFileContents.PostedFile.FileName,4).ToLower();switch(strDocExt){case ".doc":strDocType = "doc";break;case ".ppt":strDocType = "ppt";break;case ".htm":strDocType = "htm";break;case ".html":strDocType = "htm";break;case ".jpg":strDocType = "jpg";break;case ".gif":strDocType = "gif";break;case ".im":strDocType = "im";break;default:strDocType = "txt";break;}//Grab the Content of the Uploaded DocumentintDocLen = txtFileContents.PostedFile.ContentLength;//buffer to hold Document Contentsbyte[] Docbuffer = new byte[intDocLen];//InputStream://Gets a Stream object which points to an uploaded Document; //to prepare for reading the contents of the file.objStream = txtFileContents.PostedFile.InputStream;//Store the Content of the Documnet in a buffer//This buffer will be stored in the DatabaseobjStream.Read(Docbuffer ,0,intDocLen);//Add Uploaded Documnet to Database as Binary//You have to change the connection stringBooksConn = new SqlConnection("Server=66.179.84.110;UID=******;PWD=******;Database=******");//Setting the SqlCommandcmdUploadDoc = new SqlCommand("ulfile",results);cmdUploadDoc.CommandType = CommandType.StoredProcedure;cmdUploadDoc.Parameters.Add("@upload ",SqlDbType.VarChar,200);cmdUploadDoc.Parameters[0].Value = txtTitle.Text;cmdUploadDoc.Parameters[1].Value = Docbuffer ;cmdUploadDoc.Parameters[2].Value = strDocType;Results.Open();cmdUploadDoc.ExecuteNonQuery();Results.Close();}//End of if(txtFileContents.PostedFile != null)}//End Of if(IsValid)}//End of Method btnSubmit_Click}  And the form code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><!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>Untitled Page</title></head><body><form id="frmUpload" method="post" enctype="multipart/form-data" runat="server"><span>Title</span><asp:textbox id="txtTitle" runat="server" EnableViewState="False"></asp:textbox><asp:requiredfieldvalidator id="valrTitle" runat="server" ErrorMessage="* Required" ControlToValidate="txtTitle">* Required</asp:requiredfieldvalidator><span>Document to Upload</span><input id="txtFileContents" type="file" runat="server" name="txtFileContents"></></><asp:button id="btnSubmit" Text="Submit" Runat="server" OnClick="btnSubmit_Click"></asp:button>   </form></body></html>  however when I try and view in browser I get the following Line 21:
Line 22:
Line 23: Stream objStream;
Line 24: //InputStream:
Line 25: //Gets a Stream object which points to an uploaded Document;  I have trawlled the net, MSDN and anywhere else I can find to see what it is and nothing. eventually changed  Stream.objstream to System.IO.Stream objStream; And now getting the following error Line 29:
Line 30: //results is the connection object
Line 31: cmdUploadDoc = new SqlCommand("ulfile",results);
Line 32: cmdUploadDoc.CommandType = CommandType.StoredProcedure;
Line 33: //Add the Params which in the Stored Proc  Can anyone help?

View 2 Replies View Related

File Upload To SQL Server 6.5 Using Bcp

Jul 15, 1999

Hi,

I am having a problem when I upload a text file to SQL Server 6.5 with bcp utility. The special Chararcter like copy right, registreted etc are not getting uploaded as the same. Its being displayed as a different character when I fire select query from the database.
eg

CIM is getting uploaded as CIM

Please help.

Thanks in advance..

View 1 Replies View Related

What Is The Best Way To Upload Huge File Into SQL 2K

Mar 13, 2002

I have a 2 GB text file(semicolon delimited), which I need to
pump into SQL 2K. What is the best way to achieve this in shortest time?

I tried with DTS BCP, it tooks 1 minute 14 secs to transfer 13457 records. This is only 1/2000 of the record i need to transfer. Please help.

Thanks.

regards,
Terry

View 2 Replies View Related

Upload File To Sql Server

Mar 9, 2004

I got some problem in uploading file into the sql server used ASP.
There is no error occur but the file can't be upload into the database.

This is the connection to the sql server:
function GetConnection()
dim Conn
Conn.Provider = "SQLOLEDB"
Conn.Open "Server=(Local);Database=userinfo", "sa", "sa"
set GetConnection = Conn
end function

function CreateUploadTable(Conn)
dim SQL
SQL = SQL & "CREATE TABLE Upload ("
SQL = SQL & "UploadID int IDENTITY (1, 1) NOT NULL ,"
SQL = SQL & "UploadDT datetime NULL ,"
SQL = SQL & "RemoteIP char (15) NULL ,"
SQL = SQL & "ContentType char (64) NULL ,"
SQL = SQL & "SouceFileName varchar (255) NULL ,"
SQL = SQL & "Title varchar (255) NULL ,"
SQL = SQL & "Description text NULL ,"
SQL = SQL & "Data image NULL "
SQL = SQL & ")"
Conn.Execute SQL
end function

function DBSaveUpload(Fields)
dim Conn, RS
Set Conn = GetConnection

Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "Upload", Conn, 2, 2
RS.AddNew
RS("UploadDT") = Now()
RS("RemoteIP") = Request.ServerVariables("REMOTE_ADDR")
RS("ContentType") = Fields("DBFile").ContentType
RS("SouceFileName") = Fields("DBFile").FileName
RS("DataSize") = Fields("DBFile").Value.Length

RS("Description") = Fields("Description").Value.String
RS("Title") = Fields("Title").Value.String
if IncludeType=1 then'For ScriptUtilities
RS("Data").AppendChunk Fields("DBFile").Value.ByteArray
Else'For PureASP upload - String is implemented as method.
RS("Data").AppendChunk MultiByteToBinary(Fields("DBFile").Value.ByteArray)
End If

RS.Update
RS.Close
Conn.Close
DBSaveUpload = "Upload has been successfull"
end function

Pls help me!

View 1 Replies View Related

HTTP File Upload

Aug 11, 2006

I'm looking for a way with Integration Services in SQL'05 to upload a file. How could I do this? Is there any examples out there?

This partuclar HTTP Server has WEBDAV configured so if I could just point to the URL location and new FILE that would be excellent.

Thanks

View 2 Replies View Related

XLSX File Upload

Oct 23, 2007

Hi,



I uploaded an xlsx file to my reporting services. When i click on the xlsx file link in the reporting services frontend, a internet explorer window is opened with the xlsx file information (reporting services) and the xlsx file is opened by the excel application.



Is there any way to prevent the Internet explorer window to be opened?


Regards.

View 4 Replies View Related

How To Rename A File In SSIS

Sep 26, 2006

I want to rename a file that is a variable to a fixed file name in a specific folder in SQL Server System Integration Services using the File System Task Editor. Example: File1.txt to Users.txt or File2 to Users.txt.    The source file is a variable the destination file is not. Here is an example of the File System Task EditorHOW DO I SPECIFY A FIXED OR VARIABLE FOLDER NAME WITH A SPECIFIC FILE NAME?????????File System Task EditorProperties                              ValueDestination ConnectionIsDestinationPathVariable       TrueDestinationVariable                User::ArchivePathOverWriteDestination              TrueGeneralName                                    Rename a fileDescription                            File System TaskOperationOperation                             Rename fileSource ConnectionIsSourcePathVariable           TrueSourceVariable                     User::ImportFilePath Thanks

View 1 Replies View Related

ASPNETDB.MDF I Need To Rename This File

Sep 9, 2007

I need to rename this db and be able to set a path to it. This is because my webhost places all SQL databases on a seperate drive. This is a shared drive with alot of other databases. There fore my ASPNETDB.MDF needs to be renamed and have a path assigned. This doesnt seem tro be taken care of in my web.config file? Can some one help in reasigning the default database name and pathway. my other databases were pretty straight forward.
 Thanks

View 5 Replies View Related

Rename Export File After DTS

Apr 18, 2000

Hi everybody,
I am running DTS export data evry night, where my MyTable is being transformed into MyTable.txt.
In my MyTable which sits in sql 7.0 I have a field which shows today's date as julian date ( today julian date is 109).
Is there a way to write a procedure/trigger which will rename MyTable.txt on daily basis into MyTable109.txt for today;
MyTable110.txt for tomorrow; etc...
Kind of stuck with that..
Thanks alot,
rudi

View 3 Replies View Related

Upload And Save A PDF File Into MS SQL Databse

Apr 13, 2007

Hi guys,
 I want to update a PDF file and store it in the MSSQL database. (I know it is better if I save the file on server and just store the link to it, but I have to store the file on the database "Project Requirements")
I would probably use FileUpload control to upload the file. but would I upload it to server temporarly and then save it or would I just upload it to DB.
I appreciate your help and suggestions and any tips & tricks or issue that I have to consider.
Regards,Mehdi

View 2 Replies View Related

Upload File To Database Using Sqldatasource

Sep 12, 2007

Hi,I am trying to upload a file to a database. I have all the code set up but I get this error message: Operand type clash: nvarchar is incompatible with image  The following is the code that I have: 1 If FileUpload1.PostedFile Is Nothing OrElse String.IsNullOrEmpty(FileUpload1.PostedFile.FileName) OrElse FileUpload1.PostedFile.InputStream Is Nothing Then
2 lblInfo.Text = "No file selected"
3 Exit Sub
4 End If
5
6 Dim extension As String = Path.GetExtension(FileUpload1.PostedFile.FileName).ToLower()
7 Dim MIMEType As String = Nothing
8
9 Select Case extension
10 Case ".gif"
11 MIMEType = "image/gif"
12 Case ".jpg", ".jpeg", ".jpe"
13 MIMEType = "image/jpeg"
14 Case ".pdf"
15 MIMEType = "application/pdf"
16 Case ".doc"
17 MIMEType = "application/msword"
18 Case ".swf"
19 MIMEType = "application/x-shockwave-flash"
20 Case ".txt", ".html"
21 MIMEType = "text/plain"
22 Case Else
23 lblInfo.Text = "Invalid file upload"
24 Exit Sub
25 End Select
26
27 Dim imageByte(FileUpload1.PostedFile.InputStream.Length) As Byte
28 FileUpload1.PostedFile.InputStream.Read(imageByte, 0, imageByte.Length)
29
30 sqlInsert = "INSERT INTO Pages (MIMEType, ImageData) VALUES (@MIMEType, @ImageData)"
31 SqlDataSource1.InsertCommand = sqlInsert
32 SqlDataSource1.InsertParameters.Add("MIMEType", MIMEType.ToString.Trim)
33 SqlDataSource1.InsertParameters.Add("ImageData", imageByte.ToString)
34 SqlDataSource1.InsertCommand = sqlInsert
35 SqlDataSource1.Insert()
36 SqlDataSource1.InsertParameters.Clear()I problem happen at line 33. I have tried using sqldatasource1.InsertParameters.add("ImageData", imageByte), it doesn't like it.Please help  

View 2 Replies View Related

SQL Server 2000 File Upload

Oct 9, 2007

hi
i am using VS2003 and .net 1.1. i need to upload a cert file into sql server 2000. code is as follows, i am not sure if this code is working or not, its not giving any error nor throwing any exception. in this function i am only converting ther .cer file to byte array. and in other function i am passing this byte to a stored procedure. in stored procedure i have declare a parameter as "@cert binary". i cant see the binary data in sql server 2000, its only showin <binary> in that column. i need to download this file now, how can i do that. Dim selectedCert As HttpPostedFile
Dim certLength As Integer
Dim isValid As Boolean = False
'Dim imageType As String
'Dim fileUpload As System.Web.UI.HtmlControls.HtmlInputFile = .FindControl("fileUpload")
selectedCert = fileUpload.PostedFile
certLength = selectedCert.ContentLength
'imageType = selectedCert.ContentType
Session.Add("isDefaultLogo", 0) ' To check if default logo is used
If fileUpload.PostedFile.ContentLength = 0 Then
' DO NOTHING
ElseReDim binaryCert(certLength - 1)
'check if there a certificate file or not
If (selectedCert.ContentLength = 0) Then
' DO SOMETHING
Else
selectedCert.InputStream.Position = 0
selectedCert.InputStream.Read(binaryCert, 0, certLength - 1)
Response.Write(selectedCert.ContentType.ToString)
If (selectedCert.ContentType.ToLower <> "application/x-x509-ca-cert") Then
lblMsg.Visible = True
lblMsg.Text = "Only Certificate (*.cer) files are allowed."
isValid = True
Return False
End If
End If
End If
If isValid Then
TryDim strm As IO.FileStream = System.IO.File.Open(System.IO.Path.GetFullPath(fileUpload.PostedFile.FileName), IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.ReadWrite)ReDim binaryCert(strm.Length - 1)
strm.Read(binaryCert, 0, strm.Length)
strm.Close()Catch ex As Exception
Return False
End Try
End If
 
thnx in advance
cheers

View 3 Replies View Related

Upload Files And Downloading A Pdf File

Mar 5, 2008

what data type am i going to put to my uploadedFiles column in my database... uploaded files are in document format or .txt
 also.. how can i make those files converted into pdf files.. also enable users to download it..
tnx!!!
forums.asp.net = "great help"

View 7 Replies View Related

I Don't Know How Can I Upload My Sqlserver File To The Server

Jul 26, 2004

I don't know How can i upload my sqlserver file to the server
could you help me?
could you write an example code in query analyser for
uploading sql server file to database

View 1 Replies View Related

Upload (or Download) A File Into (or From) A MS SQL Server DB

Feb 6, 2006

I would like to design a content-management feature on a website, in particularbe able to upload a binary file and to store it into a MS Sql Server DB.be able to download it afterwards. The sizes of the files are very limited (less than 100Kb) so I do not need any special feature to handle the upload/download.Does anyone know how to achieve such feature?Thanks in advance,Joannes

View 5 Replies View Related







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