Question About How To Upload File Into Database(sqlserver Express)?

Jun 28, 2006

I'm a newbie.

I have googled many web sites,but i can't find the help that how to upload or store files(include images) into a database with Asp.Net 2.0.

Although i have found few samples about storing images into database,but the sample applied with Asp.Net 1.0 or 1.1 technology...

In microsoft MSDN,i found the help about FileUpload control,but the sample is about how to upload files to servers's folder with saveas() method.

Who can help me ?Give me a refer sample about upload files  to database with Asp.Net 2.0. Is it need to use stream or what other method?

By the way, i want make a document managment system with vwd and sql express.

Thank u very much if u can give me a help.

View 2 Replies


ADVERTISEMENT

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

SQL 2005 Express Database Upload(help!)

Feb 15, 2007

Hi, how are you! I'm a beginner of database. I have some really "novice" questions here. Currently I'm trying to upload my database to a share windows host server. I have problems uploading my database files. I'm using Visual Studio 2005 and SQL 2005 express version. I was told that in order to upload my database, I need to have.bak file of my database.
The problems are:
 1. under my visual studio server explorer, it seems I have two databases, one is ASPNETDB.MDF, another one is (mycomputername)sqlexpress.(databasename).dbo. I dont know from which one I can create the .bak file, and how?
2. I can not find where the phsyical location of my files (such as tables or stored procedures) from my (mycomputername)sqlexpress.(databasename).dbo database. Anyone can help? thank you!

View 3 Replies View Related

Trying To 'load' A Copy Of A SQLServer 2000 Database To SQLServer 2005 Express

Apr 18, 2008



I am trying to 'load' a copy of a SQLServer 2000 database to SQLServer 2005 Express (on another host). The copy was provided by someone else - it came to me as a MDF file only, no LDF file.

I have tried to Attach the database and it fails with a failure to load the LDF. Is there any way to bypass this issue without the LDF or do I have to have that?

The provider of the database says I can create a new database and just point to the MDF as the data source but I can't seem to find a way to do that? I am using SQL Server Management Studio Express.

Thanks!!

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

How To Transfer Data From A SqlServer Database To A SqlServer Express Database

Mar 29, 2006

Is there a way to transfer data from a SqlServer db to a SqlServer Express db. I tried to use the backup file of SqlServer, but this file is not valid for SqlServer Express. Or there any alternatives?

thanks,

Henk

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

Can I Upload A Database Using Visual Basic 05 Express Edition ?

Feb 17, 2007

Hi,
Can I upload a database using visual basic 05 express edition ? or do I have to download sql server ?
Thanks

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

How Do You Upload And Download Images And File From Database?

Mar 7, 2008

Hi,

how do i upload and download images and files from database row?is there anyway i can upload images so that uploaded images ares saved in a listbox and at the same time in the IMAGES folderin the solution explorer as well so that i can later select an image fromlistbox and download it when needed? i m using c#,vwd2005 express,sql express.

thanks.

jack.

View 38 Replies View Related

Upload A File Onto The Database - Image Datatype

Sep 23, 2005

I am using the image datatype to upload files onto SQL SErver 2000. My
problem is that it seems as though the database is only accepting files
of size 65Kb or less.
What is the best way of resolving this problem?

View 2 Replies View Related

How To Upload A Video File Into Database Using Asp.net2.0

Apr 26, 2007



Hi Pals...

I have a problem that uploading an video file into the database

using asp.net2.0 and sqlserver as database.This is urgent for me .

Please help me any one................

thanks in advance

View 10 Replies View Related

Upload Path To Sqlserver

Nov 30, 2003

hi,

i want to ask how to save the path of the upload file (not the image) to the database?

ex : client upload from his/her computer, the path is c:/Program files/image.jpg

then the upload file is saved on the web server in location c:/intepub/wwwroot/imageGallery

then i just want to save the path c:/intepub/wwwroot/imageGallery/image1.jpg at my sqlserver
so that everytime an image is req, it's just search the path and display it

and the performance is better when i use path or save the image as binary file in sql server?

do know articles or link about this?

thank you again,
erick

View 2 Replies View Related

Error: System Cannot Find The File Specified: (Microsoft.SqlServer.Express.SQLEditors)

Jan 16, 2008



I know there are already several bug submissions on this error, and I am sure the cryptoAPI team is working to resolve this issue.. However... Is it possible that the CAPICOM update (KB931906) could have contributed to this issue? In my instance, I installed SQLServer 2005 Express w/ Adv Tools SP2 after a freash XP install. I checked it out, and everything worked fine. I updated windows (online) and now it gives this error. In fact, I cannot even run the un-install because the setup utility also hits the following error (as taken from the log file):


Microsoft SQL Server 2005 Setup beginning at Wed Jan 16 12:47:35 2008
Process ID : 576
d:97352a1d146f8bca5542016500a05210setup.exe Version: 2005.90.3042.0
Running: LoadResourcesAction at: 2008/0/16 12:47:35
Complete: LoadResourcesAction at: 2008/0/16 12:47:35, returned true
Running: ParseBootstrapOptionsAction at: 2008/0/16 12:47:35
Loaded DLL:97352a1d146f8bca5542016500a05210xmlrw.dll Version:2.0.3609.0
Complete: ParseBootstrapOptionsAction at: 2008/0/16 12:47:35, returned false
Error: Action "ParseBootstrapOptionsAction" failed during execution. Error information reported during run:
Could not parse command line due to datastore exception.
Source File Name: utillibpersisthelpers.cpp
Compiler Timestamp: Wed Jun 14 16:30:14 2006
Function Name: writeEncryptedString
Source Line Number: 124
----------------------------------------------------------
writeEncryptedString() failed
Source File Name: utillibpersisthelpers.cpp
Compiler Timestamp: Wed Jun 14 16:30:14 2006
Function Name: writeEncryptedString
Source Line Number: 123
----------------------------------------------------------
Error Code: 0x80070002 (2)
Windows Error Text: The system cannot find the file specified.

Source File Name: cryptohelpercryptsameusersamemachine.cpp
Compiler Timestamp: Wed Jun 14 16:28:04 2006
Function Name: sqls::CryptSameUserSameMachine:rotectData
Source Line Number: 50

2
Could not skip Component update due to datastore exception.
Source File Name: datastorecachedpropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:27:59 2006
Function Name: CachedPropertyCollection::findProperty
Source Line Number: 130
----------------------------------------------------------
Failed to find property "InstallMediaPath" {"SetupBootstrapOptionsScope", "", "576"} in cache
Source File Name: datastorepropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:28:01 2006
Function Name: SetupBootstrapOptionsScope.InstallMediaPath
Source Line Number: 44
----------------------------------------------------------
No collector registered for scope: "SetupBootstrapOptionsScope"
Running: ValidateWinNTAction at: 2008/0/16 12:47:35
Complete: ValidateWinNTAction at: 2008/0/16 12:47:35, returned true
Running: ValidateMinOSAction at: 2008/0/16 12:47:35
Complete: ValidateMinOSAction at: 2008/0/16 12:47:35, returned true
Running: PerformSCCAction at: 2008/0/16 12:47:35
Complete: PerformSCCAction at: 2008/0/16 12:47:35, returned true
Running: ActivateLoggingAction at: 2008/0/16 12:47:35
Error: Action "ActivateLoggingAction" threw an exception during execution. Error information reported during run:
Datastore exception while trying to write logging properties.
Source File Name: datastorecachedpropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:27:59 2006
Function Name: CachedPropertyCollection::findProperty
Source Line Number: 130
----------------------------------------------------------
Failed to find property "primaryLogFiles" {"SetupStateScope", "", ""} in cache
Source File Name: datastorepropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:28:01 2006
Function Name: SetupStateScope.primaryLogFiles
Source Line Number: 44
----------------------------------------------------------
No collector registered for scope: "SetupStateScope"
00E2CFC0Unable to proceed with setup, there was a command line parsing error. : 2
Error Code: 0x80070002 (2)
Windows Error Text: The system cannot find the file specified.

Source File Name: datastorepropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:28:01 2006
Function Name: SetupBootstrapOptionsScope.InstallMediaPath
Source Line Number: 44

Failed to create CAB file due to datastore exception
Source File Name: datastorecachedpropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:27:59 2006
Function Name: CachedPropertyCollection::findProperty
Source Line Number: 130
----------------------------------------------------------
Failed to find property "HostSetup" {"SetupBootstrapOptionsScope", "", "576"} in cache
Source File Name: datastorepropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:28:01 2006
Function Name: SetupBootstrapOptionsScope.HostSetup
Source Line Number: 44
----------------------------------------------------------
No collector registered for scope: "SetupBootstrapOptionsScope"
Message pump returning: 2

Since the Microsoft.SqlServer.Express.SQLEditors utilizes a crypto wrapper, givin the error above... would the CAPICOM update have affected things?

Brian Nichols

View 1 Replies View Related

Plz Help Me To Upload My Sqlserver Data Base With Query Analyzer Method

Jul 27, 2004

plz help me to upload my sqlserver data base with query analyzer method
plz write the code i should write in query analyzer box to uplode
my database(db) in my server(h_server)
and is it neccessary to uplode log file or not
,or guide me with intruducing a site

View 2 Replies View Related

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

Problem Unicode Data 0x2300 In SQLServer 2000 SQLServer 2005 Express

Sep 20, 2006

Hi experts;
I have a problem with unicode character 0x2300
I created this table
create table testunicode (Bez nchar(128))

Insert Data
insert into testunicode (Bez)values('Œ€„¢')
with 2 Unicode characters
Œ€ = 0x2300
„¢ = 0x2122

Selecting the data
select Bez from testunicode
I see
"?„¢"

„¢ = 0x2122 is ok but instead of 0x2300 there is 0x3f

When I modify the insert statement like that ( 8960 = 0x2300 )
insert into testunicode (Bez)values(NCHAR(8960)+'„¢')

and select again voila i see
"Œ€„¢"
Does anyone have an idea?

Thanks

View 1 Replies View Related

HELP,,Imports A Data From Excel File Into A Table In SQLserver Database

May 6, 2008

Dear all,,
I need your help,,I'm work in website project using ASP.NET,,I have to register the users of this site,, the users are over 200,,so,,I'm thinking in away to save my time,,All the information of these users are stored in Excel file,,What I want to do is to imports these data from the excel file into a table in my database(SQLserver database),,Could you help in coding by VB.NETThanks in advance,,

View 9 Replies View Related

Replacing Sqlserver 2000 With Sqlserver 2005 Express

Jun 14, 2006

I have an app that uses a sqlserver 2000 jdbc driver to connect to a sqlserver 2000.

Is it possible to do a direct replacement of sqlserver 2000 with sqlserver 2005 express just by reconfiguring the app to point to the express? The app would still be using the sqlserver 2000 jdbc driver to try and make the connection.

If that is a possibility, what can be some differences in the configuration? Previously with 2000 the config information I entered is:

server name: "machinename"( or ip). I've also tried "machiname/SQLEXPRESS"

DB name: name of db instance

port: 1433(default)

user and pass.

My attempts so far results in

"java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket."

and

"java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL."

View 1 Replies View Related

How To Convert SLQ Server Express Database File To SQL Compact Edition File?

May 29, 2007

Hi all,



I have a database name MyDatabase (SQL Server Express Dabase File). Is there anyway that I could convert it to SQL Server Compact Edition File?



By the way does anyone here got any problem with programming in SQL Server Compact Edition? It troubles me.



Thanks,

bombie

View 6 Replies View Related

Post Update For SQLServer SP2--is There One For SQLServer Express?

Apr 18, 2007

Regarding KB935356, is there a "post" service pack 2 update for SQLServer Express?



Thanks.

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

How To Upload Data Frm Access To MS SQL Server Express Edition

Jun 30, 2007

 Dear SirI am using SQL Server express edition for my database.i have downloaded sql server mangement studio also .i have my data in access(.mdb) i want to import those data to my sqlserver express .One option i am using using odbc datasource but it doesnot take care for my constraints applied i.e primarykey,indexing no duplicate etc, .Any way if can do it again also in sql server express but the problem is when i try to do it with 2 lacs of data it shows error "time expires "  ..Can any body tell how to upload data to an existing table of sql server .since i could not find DTS in express edition.Thanks and regardsmukesh 

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

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







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