• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 712
  • Last Modified:

Import delimited data into SQL Server database via textarea form field using ASP.NET

Greetings,

I am trying to find a way to import comma delimited data into a SQL Server database via a textarea form field using ASP.NET.

Here is some background.  I work for a school and I am trying to setup an online application where instructors can easily transfer student grades from a grade book application into an online database using a web form.  I already created the online database and have ASP.NET pages setup for viewing and searching records.  Now I just need the web form where the instructors paste the delimited data and hit submit to import it into the database.  

The delimited data that would get pasted into the textarea field looks something like this:

"Smtih, John",3434983,Fall 2005,HIST 101,A
"Rosenberg, Greg",3434984,Fall 2005,HIST 101,B
"Hall, John",3434985,Fall 2005,HIST 101,B+
"Perry, Joan",3434986,Fall 2005,HIST 101,C
"Lemke, Adrian",3434987,Fall 2005,HIST 101,C-
"Nguen, Jennifer",3434988,Fall 2005,HIST 101,D
"Arlan, Smantha",3434989,Fall 2005,HIST 101,A
"Jimenez, Damian",3434990,Fall 2005,HIST 101,B

Here are details on the database where it will be imported:

Database name: GradeArchive
Table: TblStudentGrades
Field/column names that correspond to delimited text to import:

StudentName
StudentID
Semester
Course
Grade

 Any help would be greatly appreciated.

Thanks!
0
relaydude
Asked:
relaydude
1 Solution
 
f_o_o_k_yCommented:
Hello,
First of all databes design is really bad, but this is not what you are asking.
If you want to insert these data you can use two things.
1. Write your own code for parsing CSV.
2. Find some framework I remember that LumenWorks can parse CVS and then you can get to each fild like there were a table

First of all you need to use loop and go throught each line.
Then you need to split each line by , and check if line has apropriate number of ,
After that you need to insert data to databe

Do you need some example code?
Best Regards
FooKy
0
 
relaydudeAuthor Commented:
Hi Fooky,

Thanks for the response.  Yes...if you have some example code that would be great.  I am still sort of a newbie with respect to ASP.NET, so I am sort of hoping to get my hands on some code that either works, or doesn't take a lot of tweaking to make work.

I Googled LumenWorks and saw a few things that talked about importing csv, but nothing really specific to ASP.NET.

Thanks again.
0
 
nmcdermaidCommented:
Maybe there is some kind of ASP.Net grid control that you can paste CSV directly into? In the same way that you can paste a CSV directly into an Excel file.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
f_o_o_k_yCommented:
Hello
relaydude:
I'm so sorry for delay.
Here is an article about using lumenworks and example code.
http://www.codeproject.com/KB/database/CsvReader.aspx

Hope this will be helpful and explain you everything.
If you need any further help just ask.

And again sorry for delay.
Best Regards
FooKy
0
 
relaydudeAuthor Commented:
Thanks guys for the suggestions.  Sorry for the delayed response, I've been out of town and I am just getting caught up.  I'll give those suggestions a try and report back as soon as I can on whether or not I've been able to achieve my objective.  Thanks again.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now