473,698 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to upload file to SQL Server for Bulk Insert?

ABC
Our environment has two servers, one is web and another is SQL Server. I
can write upload file to IIS. But, I cannot call SQL Server's BULK Insert
statement.

Is there any idea to handle this case?
May 11 '06 #1
1 2246
you canread content with FileUpload class

byte[] fileContent = new byte[FileUpload.Post edFile.ContentL ength];

string sFileName =
System.IO.Path. GetFileName(Fil eUpload.PostedF ile.FileName);

FileUpload.Post edFile.InputStr eam.Read(fileCo ntent, 0,
FileUpload.Post edFile.ContentL ength);

and then save it to database with insert query (use image for SQL column
type )

Hope this helps
--
Galin Iliev [MCSD, MCSD.NET]
Senior Software Developer
www.wordassist.com

"ABC" <ab*@abc.com> wrote in message
news:eH******** ******@TK2MSFTN GP05.phx.gbl...
Our environment has two servers, one is web and another is SQL Server. I
can write upload file to IIS. But, I cannot call SQL Server's BULK Insert
statement.

Is there any idea to handle this case?

May 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2840
by: JT | last post by:
i have written some asp that reads a fixed length text file, line by line, inserting each line into my database. my problem is that the text file format seems to have extra space at the end of the file so my code thinks there is actually one more line when there is not. is there a way to remove these spaces before i loop through the file? here is my sample code: Do While df.AtEndOfStream <> True line = df.ReadLine
7
12122
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the servers using sp_addlinkedserver on both database servers. When I call the Commit API of oledb I get the following error: Error state: 1, Severity: 19, Server: TST-PROC22, Line#: 1, msg:
7
2713
by: Bob | last post by:
Hi, I am trying to use BULK INSERT with format file. All of our data has few bytes of header in the data file which I would like to skip before doing BULK INSERT. Is it possible to write format file to skip these few bytes of header before doing BULK INSERT? For example, I have a 1 GB data file with 1000 byte header. Except for first 1000 bytes, rest of the data is good for BULK INSERT.
2
3723
by: KR | last post by:
I am trying to copy the data in excel file into a table using the bcp and this is the code that I have. However the bcp utility does not seem to create a format file, which I thought it should do. I am probably going about this all wrong so any help would be useful. exec master..xp_cmdshell '(FOR %i IN ("E:\WUTemp\*") DO (bcp #ProspectImportTest in "%i" -fE:\WUTemp\Prospect.fmt)' bulk insert #ProspectImportTest from 'E:\WUTemp\*."'...
1
1529
by: ABC | last post by:
Our environment has two servers, one is web and another is SQL Server. I want a upload page to upload file (which I done.). Then I call "Bulk Insert" command from ADO.NET, it cannot do that as SQL Server cannot access the file on Web Server. I made sure the SQL login user have Bulk-insert rights. We cannot use BLOB feature as this is not sure my case. Our aim is insert data which stored on text file into some tables.
1
8945
by: Jennifer | last post by:
I'm trying to do an insert using Bulk Insert with a fixed length file. I'm using a format file. I'm getting the following error message: Cannot perform bulk insert. Invalid collation name for source column 16 in format file '\\wbhq.com\dfsdv\iDataInt\GOPFiles\GOPFormatFile.txt'. Any suggestions are appreciated. Thanks! Jennifer
0
1052
by: teddymeu | last post by:
I have a web app ive built in Visual studio 2005 VB.net and uses sql server. However the Server this will be applied on doesnt have sql server so will utilise an mdf database. I am very new to all this so please be patient with me. The app searches postoffices via street address, post code or town and works fine, my problem is that i need to be able to upload csv of the post office information into my db, i cant use bulk insert or dts so...
3
22537
by: AB | last post by:
Hi to all, I have a problem about a importation of a file *.csv with SQL Server, through a bulk insert, called in a store procedure that a c# sw calls. This is the description of the error: ----- System.Data.SqlClient.SqlException è stata individuata Message="Bulk Insert: Unexpected end-of-file (EOF) encountered in data file.\r\nOLE DB provider 'STREAM' reported an error. The provider did not give any information about the error.\r\nOLE...
2
4517
by: jthep | last post by:
How can I use bulk insert to insert a text file where the columns in the text file is in different order than the columns in the table? I have a ZIP table with Zip_Code, Zip_City, Zip_State and the text file has the fields in Zip_City, Zip_State, Zip_Code. The instructions were to keep the order as defined in the Entity Definition which would be the first order. My code for the bulk insert is usually BULK INSERT DB2914.dbo. FROM...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7716
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.