SQL Server :: Reading File Csv And Inserting Into SqlCE Performance Improvement?

Dec 15, 2010

NOTE: Code and names simplified for post. Elimination of try catch and other best practices also limited for post.

I have a simple SqlCE database one table consisting of 4 columns (specialvalue, name, state)

I am using a streamreader from a file.txt that contains 3000 lines of csv data, looping the below.

s[] = {id,name,specialvalue,state) //(SAMPLE DATA-displaying names)
while(!sr.EndOfStream)
{

[Code]....

This code works as expected but I would like to increase the performance since it takes over 30 sec to complete. I will be moving to a stored procedure later but would like to find out how to optimize the current code. This is more for experience than anything. It is a project that I am working on for codeplex.

View 2 Replies


Similar Messages:

SQL Server :: Reading And Checking .CSV File And Inserting Data To SQL Server

Sep 30, 2010

I have got a page in which there is a file upload option where I have to upload/import the csv file. What I want to do is to check if the correct format of file is uploaded for instance if any other than csv file is uploaded, the system should give an error message. Also what I need to do is to check certain fields of the csv file for instance there are some mandatory fields in the csv file which should be there like name , postcode, How can I check that these fields are not empty . After performing these task, the system should automatically upload the csv file onto the sql sever 2008.

View 3 Replies

SQL Server :: Reading Xml File And Inserting Data Into A Tsql Table (no Duplicates)?

Feb 25, 2011

I am writing code to insert values from an xml file. I check for a duplicate before inserting and delete if there is a match. Is there a more effecient way to prevent duplicates before insert a record? my code: private void LoadFData() { SqlConnection oConn = new SqlConnection(ConnectionString); SqlCommand oCommand = new SqlCommand(); oCommand.Connection = oConn; oCommand.CommandType = CommandType.Text; oConn.Open(); // Load committee master files string[] strFiles = System.IO.Directory.GetFiles("fff", "ffff.dta", System.IO.SearchOption.AllDirectories); for (int i=0; i

View 2 Replies

Web Forms :: Reading Data From Excel File And Inserting Into Sql Server - Initialize HasFile?

May 24, 2010

I am using reading data from excel file and inserting into sql server using following article, it seems to be working correctly except when I do page refresh normally, it again execute the the btnUpload_click. I want that once the record imported and if user refresh the page again it should ask for enter file name again. let me know how do I resolve this? [URL]

View 8 Replies

SQL Server :: Reading Text File Using Sql Server 2000 - 2008

Sep 22, 2010

how to read the data's in the text file using sql server 2000 and 2008. i have a text file in a server and it contains one column name with the multiple column values i need to read that informations and i need to update in a table in the database.

View 2 Replies

VS 2010 - Reading A File From Server

Nov 22, 2013

I am trying to read a text file from the root of the server. This is what I tried

Code:
Dim sr As StreamReader
Try
sr = File.OpenText("~ est.txt")
Label1.Text = sr.ReadToEnd
Catch ex As Exception
Label1.Text = ex.Message
End Try

If I test this locally, I get the error: "Could not find a part of the path 'C:Program Files (x86)Common FilesMicrosoft SharedDevServer10.est.txt'."If I upload it and run the code on the server, nothing happens (Lable1.text does not change).

View 3 Replies

SQL Server :: Reading Data From .CSV File Into Sql Database

Jul 15, 2010

I urgently need to find a way of reading data from a .CSV or .xls(Excel) file into an sql database so that I can use it in my asp.net 2.0 application.

View 4 Replies

Configuration :: Reading Problem In XLS File In 64 Bit Server?

Sep 9, 2010

Reading XLS file in 64 bit server , following errror "microsoft.jet.oledb.4.0 not registered on local Is any solution for this problem?

View 1 Replies

SQL Server :: Inserting A File Into DB?

Jan 31, 2011

I am inserting a file using fileupload control below is my code[Code]....

but i am getting the error at cmd.executereader() like Incorrect syntax near ')'.

View 4 Replies

Reading A File Into Memory And Then Reading It One Line At A Time?

Mar 7, 2011

I know this is probably a pretty easy thing to do and it is if I can upload the file and store it onto the hard drive of the server. What I need to do is read the text file into memory and then parse through it one line at a time. Anyone have any code that demonstrates that?

View 8 Replies

DataSource Controls :: Reading From SQL Server And Saving As Physical File

Mar 26, 2010

I have to create PDF Files reading data from SQL Server where the data is in Binary format as Image data type.

View 2 Replies

Reading An Embedded File From A Custom Server Control An Rendering It?

Mar 31, 2010

I currently have a file "abc.htm" in my Custom Server Control Project and it's Build Action is set to Embedded Resource.Now in the RenderContents(HtmlTextWriter output) method, I need to read that file and render it on the website.I am trying the following but it's to no avail:

protected override void RenderContents(HtmlTextWriter output)
{
var providersURL = Page.ClientScript.GetWebResourceUrl(typeof (OpenIDSel), "OpenIDSelector.Providers.htm");
var fi = new FileInfo(providersURL); // <- exception here
//the remaining code is to possibly render the file
}

This is an example of how the providersURL is:

/WebResource.axd?d=kyU2OiYu6lwshLH4pRUCUmG-pzI4xDC1ii9u032IPWwUzMsFzFHzL3veInwslz8Y0&t=634056587753507131

FileInfo is throwing System.ArgumentException: Illegal characters in path.

View 1 Replies

ADO.NET :: Is Possible To Create Foregin Key In SQLCE

Feb 24, 2011

is possible to create Foregin key in SQLCE...

View 1 Replies

DataSource Controls :: Inserting Excel Data Via File Upload Into Sql Server Database?

Apr 28, 2010

I have requirement that User can Upload the Excel Sheet Data to sql server Database at once.

View 16 Replies

C# - Reducing Output Page Size Perfomance Improvement?

Jan 20, 2011

I need to improve the speed of my website and perfomance.

I've tried everything under the book from compression handling , whitespace removal , update panels and enable view state false.. but nothing seem to work.

The output page size is still 764 kb.. which is quite a lot. So can you guys tell me an out of the box or any other way to approach this to decrease the output page size!

View 3 Replies

Web Forms :: Automatic File Reading / Check For New File Everyday And If The New File Is In The Folder Read It

Sep 20, 2010

I would like ask you for some ideas how can I write mechanism that will be automatically read files from folder. I don't know how to schedule the write task. I want to check for new file everyday and if the new file is in the folder read it.

View 2 Replies

SQL Server :: Escape A Comma "," When Reading From A .csv File

Jul 30, 2010

I have data that I am trying to read in from a .csv file. Some of my fields however have their own commas. For instance my file may look like:

Name, City, Country

And my data may have:

Walmart, New York, USA

"My store, and more", New York, USA

If you look at the second row of my data you will notice the first field has a comma in it: "My Store, and more".

It is surrounded by double quotes to distinguish that the field includes the comma, but when I read it into a table in MSSQL it splits that field into two. How do I tell MSSQL to leave everything in the double quotes as one field?

View 2 Replies

WCF / ASMX :: Add Service Reference Reading Svc File But Not Reading Service?

Mar 10, 2011

I was trying to go through this tutorial:

[URL]

but when I tried to add the service reference to the silverlight app, the Add Service Reference window would show me that there was a service file, but the node wouldn't expand to show the rest of the files that contain the services and what not. I got this error instead:

"An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately."

"Parser Error Message:There is no service behavior named 'AdventureWorks_WebServer.Service1Behavior'."

"Metadata contains a reference that cannot be resolved: 'http://localhost:55579/Service1.svc'.

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

If the service is defined in the current solution, try building the solution and adding the service reference again."

here's my web.config file:

[Code]....

View 1 Replies

Databases :: Upload Ms Word File And Store It Into Database Then Reading The File?

Jan 12, 2011

i like to create a web application,in that i need to get the resumes from the user,then i need to publish that resume to the manager in date wise..

View 5 Replies

WCF / ASMX :: Web Service Reading *.txt File .this File Contains Some Special Characters Like "?

Jan 21, 2011

In web service reading *.txt file .this file contains some special characters like "" .so its shows error while reading .

string fullPath = Server.MapPath("sample.txt");
string reconciliationData = string.Empty;
StreamReader ObjReconciliationDataStream = new StreamReader(fullPath, Encoding.UTF8);
string strReconData = ObjReconciliationDataStream.ReadToEnd();
ObjReconciliationDataStream.Close();
ObjReconciliationDataStream = null;
return strReconData;

above code i am using .

View 2 Replies

Reading Txt File And Modify Content To A Output File?

Jan 5, 2011

I would like to find a way to read a txt file (in my case delimited by €). I need to change the order of the columns and also add and remove some columns. My output file should be a txt file delmited by ;.

I tried Jet.OLEDB to read the file and put it into a datatable and then used a stringBuilder and streamwriter to get an output file in .txt format. However. This does not me since IŽ, reading the txt file from start to end and my output will be the same. It does not seem like I can have a custom sql statement when reading the file. The only query that works is

Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from 1.txt", TextConn)

How can I possible modify a txt file?

This is my code for now:

[Code]....

View 1 Replies

Performance Code-Behind Vs. Class File?

Apr 2, 2010

I was wondering which of these two is better from the aspect of performance.

I was thinking that possibly Class files stored in App_Code works faster because they are sort of pre-compiled but i am not 100% sure.

Specifically i am overriding onInit event on each page using some functions that i am not certain where to place.

Not that i complaint on the speed but i want to be sure that i am doing the right thing.

View 7 Replies

Configuration :: .Net Website Performance Of 2 Sites - Rectify The DB Performance While Insertion?

Sep 20, 2010

I have developed a website in asp.net framework 2 . This website is being hosted in two different servers without any change in code. My issue is about the performance of these 2 sites. One website is taking much time for inserting datas to the DB (SQL server 2005). 2 websites are having different DB server.

I think the issue is for the DB server. How can we rectify the DB performance while insertion and Is there any other cause for this permance issue?

View 1 Replies

How Big Can An XML File Be Before Performance Will Suffer When Powering An ASP.Net Application

Oct 9, 2010

I have an ASP.Net application that has some data driven elements powered by XML with some very basic XPath queries. How big can an XML file become e.g. 10MB, 50MB before the application should start to see a dip in performance when reading from the file.

View 2 Replies

C# - Page Content In Database Vs File Performance?

Sep 29, 2010

I am creating a site whose content is dynamic and has images in it.How much performance hit will my DB (MSSQL) take if I save content/Images in DB?

View 3 Replies







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