.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
satyapriyanayak
SP
Sambanthamoorthy
Ashutosh Jha
Imran Ghani
Post New Web Links

Reading and checking .CSV File and Inserting Data to SQL server

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net
 

Hi,

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. Any ideas  or tutorial ... will be highly appreciated. 




View Complete Post


More Related Resource Links

Reading data from .doc or .docx and inserting into db

  

Hello,

A vendor is providing content which needs to be inserted into the db. The content is basically questions with options and explanations. An example is below.

=========================================

Insert Excel Data via File Upload into sql server database???

  
Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

sync your shairpoint data with your file server

  
is it posseble to sync al the files on my file server to my shairpoint server.   now its done with shairpoint workspace. bath when a employee makes a new file on the file server it wont sync

Descompress BLOB data form SQL server into a file

  
Hello guys..... I have a question for developers in SQL Server. I need to migrate data from one table to another, i will use SSIS to do the job, i have no problem with this, but during the migration i need to read a column that contains BLOB data (documents .docx .xlsx .pdf etc) and generate and sownload the file in a folder directory. I need to implement this functionality into SQL entorn (SSIS package), do you know if exist any function in SQL that could do the job, or any extend functionality form .net that could be included or called from SQL SSIS in order to be executed? I will appreciate your support, thanks. PS        

buffer data from a sql server database file

  
I'm in need of a sample code that will let me buffer data from a database so that I can go next> and <prev in a database file. Does someone have an idea on now to do this. Joe      Toppers BBS http://toppersbbs.dtdns.net C# Windows and Console applications. PHP, Mysql. HTML

Inserting a Binary file in SQL Server 2000

  
Hi all, I want to store a native binary file into the DB having the column datatype as 'image', in SQL Server 2000, through SQL Query. I have found the solution for the case of 2005, thet is using the OPENROWSET and BULK. Can you please help me out in constructing the SQL or TSQL Query for performing that operation? Thanks a Bunch in Advance :)

Appointment validation checking and data inserting

  
I am beginner of asp.net and c#Currently i doing appointment website and need suggestions/ ideas. I have create a simple web form  with Calender Control as picture below enable users to select date and time. At the calender control, i have set that users can only select tuesday and thursday every month using DayRender. After that i put a DropDownList to display the time. Next step, i want to store the data into database, for example UserA make appointment on Date 21 September 2010, Time 1100 and make it unavailable for other bookings. When UserB makes appointment on same Date and Time, it will display information that the slot is booked/unavailable. To implement this, what approach should i take? When i insert the data into database should i convert the value of DropDownList to time format or just insert DropDownList.Text? If i just insert according to DropDownList.Text will it having problem in check the slot is booked or not? <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>0900</asp:ListItem> <asp:ListItem>1000</asp:ListItem> <asp:ListItem>1100</asp:ListItem> <asp:ListItem>1200</asp:ListItem> <asp:ListItem>1400</asp:ListItem> <asp:ListItem>1500</asp:ListItem> <asp:ListItem>1600</asp:L

Reading binary Data from Sql Server.

  
 am trying to read data from a sql 2000 database.

one of the fields is defined as datatype:image, Length:16.

when I am in SQL management studio  and do a select for this one column

0x10285C0900000000000000007A44010000000100000002000000626E224931889FCA16AC80E78B8048B88095CB807EA08049B580E2B2804CC180FBC180FCB38048B7807CB6801EC8802FB68061C080AEBC803DBF807BB9807CB28046D1809BB98095B780E2B880C8BC80C6C98081BD8062B480E2B48061C38073BB80FBBF8094C080C9B68040C7802FB78095BC8061BF80C7C080E8BA802FB480E1C4338045C28096B380AEBE338084B480FBC180E2B68060CE80E2B680F3B48047C580C9B680ADC780E6B68094BD8014C48094C1802BB580C8B880F9CB80AEBA80E1C2801AAF8014BD80ADC6807BB980AFC78062B68048B98094C280EABE8014BD8094BF8061C1802FB380D8C580E2B98060CD80C8B98055A6802DC58095B880F9CB800ABA80E3AE8046C90080CAAB802FB080E0CA80FBBC8092D08007B28013C78011DD80018080B48980D2E880A7FE8096B280B1A18000B38094C180ACCC807DAB80D8C5802FB88095B78060C98031B48093C78049B38093C88047C08048A880FAC780AFB48014C4800EC28014BF8062BB80E1BE9A802FB78093C880C8B58047C68000B380AFB18046CE8062B680A9C88016AC8048BF80C7C08061BD80DAC98016B580AEBB8062B7801EC880E2B6807BBE80FAC38031B4807AC6802FB4807AC3807AC18046B580E1C280E2B48047C680BDB88060C78095B680C8BD8030C18030AF8093CC8015B780AEC18035BC80C8B8802EC18062B680D1C68015B580E1C18062B580B7CA807AC48063AC8013C780FBB7804ABD8014C1807CB580FBBE80B4C280FBC080FCB3802DCB80B5B58062BB807AC680B0B0807AC3

How can we insert csv file data into Sql server table based on some condition ?

  

Hello All experts there,

 

I need to insert some csv file data into sql server 2008. but there are multiple tables created in sql server and I need to check some conditions before data insertion and based on the condition value, sql script should insert the data in to specific table. in other words I need to insert data from one csv file to different tables based on some condition.

is it possible? if yes then can anyone please give me an idea on how can we do that?

 

Thanks in advance

Regards

Nipendra Garg


reading text file using sql server 2000 , 2008

  

hi,

can any one tell me 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.

how can we do this.

Regards,

lawmen



SQL Server 2008 R2 Disk Usage report showing incorrect data file

  

When I go to ANY database (System, AdventureWorks*, user) in Managemant Studio, I right-click on the db, select Reports, select Standard Reports, and select Disk Usage.  The disk usage report shows the correct db on top, but always only shows AdventureWorks_Data.mdf when I expand Disk Space Used by Data Files section.  This happens to any db I try.  When I look at Database Properties/Files for that database, the logical and physical file names are correct.

Since the correct files appear in Database Properties/Files, I'm hoping it's just a bug in the report.  Same thing happens if I run a Disk Usage by Table report for ANY database,  The tables for AdventureWorks always only appear,

Thanks,  Mike


SQL Server 2008 r2 - Setup support files - Install error / reading from file

  

I'm installing SQL server 2008 r2 on a Win2003 R2 x86 system.

After i start the setup, the "setup support files" box begins installing, after a while i get this error:

"Error reading from file f:\1033_ENU_LP\x86\setup\sqlsupport_msi\PFiles\SqlServr\100\Setup\ewbfphdh\x86\Patch\rs2000.msp verify that the file exists and that you can access it."

I've tried another DVD, i've tried a mounted share on another machine...no go....i've tried an ISO file mounted on this server... same error.

Is there any way i can install this "setup support files" from another location? (download)

Is there a switch soo it won't install reporting services? (...i think this file rs2000.msp is from reporting services)

Thanks

Pipas

 

 


Reading Data From File Gets Corrupted

  

I am reading data from a TXT file that requires me to replace some of the existing data, and then write it back to the file.  The issue is, there are special characters in the file that get corrupted when I write the text back to the file.

For example, I have a string in a file "foo.txt" that has the following "?rdrf  +À [HIGH]".  My application reads the text into a string, goes through the line and replaces [HIGH] with a value, and then writes back to the file.  The issue is, the special text characters get corrupted.

Here is an abbreviated version of the code base:

string fileText = System.IO.File.ReadAllText("foo.txt");
fileText= iPhoneReferenceText.Replace("[HIGH]", low);
TextWriter tw = new StreamWriter

Reading a huge file from data base

  

Hi all.

I have a 1.5 GB file into a table. I want to read It from server and create a file stream with it for save.

When I use DataAdapter.Fill(DataSet); code OutOfMemoryException occurs.

What should I do for read a hage file from data base?



Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend